Explorar el Código

[pelican_comment_system] Fixes wrong item url and title in the all comment feed

Bernhard Scheirle hace 10 años
padre
commit
1f7c6c8305

+ 2 - 0
pelican_comment_system/comment.py

@@ -15,6 +15,8 @@ class Comment(Content):
     mandatory_properties = ('author', 'date')
     default_template = 'None'
 
+    article = None
+
     def __init__(self, content, metadata, settings, source_path, context):
         # Strip the path off the full filename.
         name = os.path.split(source_path)[1]

+ 6 - 0
pelican_comment_system/pelican_comment_system.py

@@ -106,6 +106,11 @@ def write_feed_all(gen, writer):
     global _all_comments
     _all_comments = sorted(_all_comments)
     _all_comments.reverse()
+
+    for com in _all_comments:
+        com.title = com.article.title + " - " + com.title
+        com.override_url = com.article.url + com.url
+
     writer = Writer(gen.output_path, settings=gen.settings)
     writer.write_feed(_all_comments, context, path)
 
@@ -157,6 +162,7 @@ def add_static_comments(gen, content):
                 base_path=folder, path=file,
                 content_class=Comment, context=context)
 
+            com.article = content
             _all_comments.append(com)
 
             if hasattr(com, 'replyto'):