add categories to post

This commit is contained in:
rra 2021-09-09 19:40:56 +02:00
parent 162ecce865
commit acb8ea4d08
2 changed files with 6 additions and 3 deletions

View File

@ -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}}"]
--- ---

View File

@ -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)