From acb8ea4d08173ce41d04be5a363b06cc49fd574b Mon Sep 17 00:00:00 2001 From: rra Date: Thu, 9 Sep 2021 19:40:56 +0200 Subject: [PATCH] add categories to post --- post_template.md | 1 + rss_aggregator.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/post_template.md b/post_template.md index c1135b8..4a479c8 100644 --- a/post_template.md +++ b/post_template.md @@ -5,6 +5,7 @@ draft: false summary: "{{ frontmatter.summary }}" author: "{{ frontmatter.author }}" original_link: "{{ frontmatter.original_link }}" +categories: ["network, {{ frontmatter.feed_name}}"] --- diff --git a/rss_aggregator.py b/rss_aggregator.py index 3edb13f..3a2fda6 100644 --- a/rss_aggregator.py +++ b/rss_aggregator.py @@ -66,7 +66,8 @@ def create_frontmatter(entry): 'date': published.format(), 'summary': '', 'author': author, - 'original_link': entry.link + 'original_link': entry.link, + 'feed_name': entry['feed_name'] } return frontmatter @@ -172,8 +173,8 @@ env = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.curdir) ) -#output_dir = os.environ.get('OUTPUT_DIR', '/home/r/Programming/lumbung.space/lumbung.space-web/content/posts/') -output_dir = os.environ.get('OUTPUT_DIR', 'network/') +output_dir = os.environ.get('OUTPUT_DIR', '/home/r/Programming/lumbung.space/lumbung.space-web/content/posts/') +#output_dir = os.environ.get('OUTPUT_DIR', 'network/') if not os.path.exists(output_dir): os.makedirs(output_dir) @@ -198,6 +199,7 @@ for feed_url in feed_urls: for entry in data.entries: # if 'tags' in entry: # print(entry.title, entry.tags) + entry['feed_name'] = feed_name post_name = slugify(entry.title) post_dir = os.path.join(output_dir, feed_name, post_name)