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 }}" summary: "{{ frontmatter.summary }}"
author: "{{ frontmatter.author }}" author: "{{ frontmatter.author }}"
original_link: "{{ frontmatter.original_link }}" original_link: "{{ frontmatter.original_link }}"
feed_name: "{{ frontmatter.feed_name}}"
categories: ["network", "{{ frontmatter.feed_name}}"] categories: ["network", "{{ frontmatter.feed_name}}"]
tags: {{ frontmatter.tags }}
--- ---
{{ content }} {{ content }}

14
rss_aggregator.py

@ -61,13 +61,20 @@ def create_frontmatter(entry):
else: else:
author = '' author = ''
if 'tags' in entry:
#TODO finish categories
tags = []
for t in entry.tags:
tags.append(t['term'])
frontmatter = { frontmatter = {
'title':entry.title, 'title':entry.title,
'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'] 'feed_name': entry['feed_name'],
'tags': str(tags)
} }
return frontmatter return frontmatter
@ -198,7 +205,10 @@ for feed_url in feed_urls:
if data: if data:
for entry in data.entries: for entry in data.entries:
# if 'tags' in entry: # 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 entry['feed_name'] = feed_name
post_name = slugify(entry.title) post_name = slugify(entry.title)

Loading…
Cancel
Save