Browse Source

add tags to post meta, fix #3

master
rra 3 years ago
parent
commit
fbb22d64fc
  1. 2
      post_template.md
  2. 14
      rss_aggregator.py

2
post_template.md

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

14
rss_aggregator.py

@ -61,13 +61,20 @@ def create_frontmatter(entry):
else:
author = ''
if 'tags' in entry:
#TODO finish categories
tags = []
for t in entry.tags:
tags.append(t['term'])
frontmatter = {
'title':entry.title,
'date': published.format(),
'summary': '',
'author': author,
'original_link': entry.link,
'feed_name': entry['feed_name']
'feed_name': entry['feed_name'],
'tags': str(tags)
}
return frontmatter
@ -198,7 +205,10 @@ for feed_url in feed_urls:
if data:
for entry in data.entries:
# if 'tags' in entry:
# print(entry.title, entry.tags)
# for tag in entry.tags:
# for x in ['lumbung.space', 'D15', 'lumbung']:
# if x in tag['term']:
# print(entry.title)
entry['feed_name'] = feed_name
post_name = slugify(entry.title)

Loading…
Cancel
Save