Pelican plugin to create tiny single-page feeds
git clone https://github.com/m-col/pelican-microfeed
Files | Refs | Readme

Commit bb30ea78bd1b68f625b336ab5fd3e7e729c706f5
Parent: 9f305fd922dad3b7022375a76277957eeb16751b
Author: mcol <mcol@posteo.net>
Date: 2019-11-24 21:12:45 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2019-11-24 21:12:45 +0000

Allow outputting of individual entries as articles

microfeed.py Modified

@@ -18,6 +18,8 @@
 """
 
 
+from functools import partial
+
 from pelican import signals
 
 
@@ -100,6 +102,14 @@
                 feed_title=cat.name,
                 feed_type='rss'
             )
+    if article_generator.settings.get('GENERATE_MICROFEED_POSTS', False):
+        write = partial(
+            writer.write_file,
+            relative_urls=article_generator.settings['RELATIVE_URLS'],
+        )
+        for cat_name in microfeed.categories:
+            article_generator.articles = microfeed.articles[cat_name]
+            article_generator.generate_articles(write)
 
 def register():
     signals.initialized.connect(get_categories)

README.rst Modified

@@ -1,8 +1,8 @@
 microfeed - Pelican plugin
 ==========================
 
-microfeeds allows for the creation of pages that each act as a feed of content separate
-to the main articles. The how and what:
+microfeeds allows for the creation of pages that each act as a feed of content
+separate to the main articles. The how and what:
 
  - Write articles under a category that will be used to make a microfeed.
  - Create the config setting MICROFEEDS as a list of these categories.
@@ -12,3 +12,7 @@
    as microfeed.*category* or microfeed[*category*] (these are equivalent).
  - Each microfeed will also generate an ATOM/RSS feed as usual if you have set
    CATEGORY_FEED_ATOM or CATEGORY_FEED_RSS.
+ - The GENERATE_MICROFEED_POSTS setting can be set to True to make the
+   microfeed entries still generate individual articles at the very end of
+   generation, still keeping them hidden from all other pages except via the
+   microfeed object.