Browse Source

add categories to post

master
rra 3 years ago
parent
commit
acb8ea4d08
  1. 1
      post_template.md
  2. 8
      rss_aggregator.py

1
post_template.md

@ -5,6 +5,7 @@ draft: false
summary: "{{ frontmatter.summary }}" summary: "{{ frontmatter.summary }}"
author: "{{ frontmatter.author }}" author: "{{ frontmatter.author }}"
original_link: "{{ frontmatter.original_link }}" original_link: "{{ frontmatter.original_link }}"
categories: ["network, {{ frontmatter.feed_name}}"]
--- ---

8
rss_aggregator.py

@ -66,7 +66,8 @@ def create_frontmatter(entry):
'date': published.format(), 'date': published.format(),
'summary': '', 'summary': '',
'author': author, 'author': author,
'original_link': entry.link 'original_link': entry.link,
'feed_name': entry['feed_name']
} }
return frontmatter return frontmatter
@ -172,8 +173,8 @@ env = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.curdir) 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', '/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', 'network/')
if not os.path.exists(output_dir): if not os.path.exists(output_dir):
os.makedirs(output_dir) os.makedirs(output_dir)
@ -198,6 +199,7 @@ for feed_url in feed_urls:
for entry in data.entries: for entry in data.entries:
# if 'tags' in entry: # if 'tags' in entry:
# print(entry.title, entry.tags) # print(entry.title, entry.tags)
entry['feed_name'] = feed_name
post_name = slugify(entry.title) post_name = slugify(entry.title)
post_dir = os.path.join(output_dir, feed_name, post_name) post_dir = os.path.join(output_dir, feed_name, post_name)

Loading…
Cancel
Save