Skip to content
Snippets Groups Projects
Commit 109528f5 authored by Nikos Roussos's avatar Nikos Roussos
Browse files

Fix feed content tag

parent 879df966
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -163,14 +163,17 @@ def generate_archive(posts, tag_set):
def generate_feeds(posts, tag_set):
print('Generating atom feed...')
 
updated = str(time.strftime('%Y-%m-%dT%H:%M:%SZ'))
env = Environment()
env.loader = FileSystemLoader('templates')
xml = env.get_template('feed.xml').render(
items=posts,
items=posts[:10],
sitename=cfg['sitename'],
author=cfg['author'],
rooturl=cfg['rooturl'],
license=cfg['license']
license=cfg['license'],
updated=updated
)
with open('feed.xml', 'w') as file:
file.write(xml)
Loading
Loading
@@ -178,7 +181,7 @@ def generate_feeds(posts, tag_set):
for tag in tag_set:
print('Generating {0} atom feed...'.format(tag))
post_list = []
for post in posts:
for post in posts[:10]:
if tag in post['tags']:
post_list.append(post)
xml = env.get_template('feed.xml').render(
Loading
Loading
@@ -186,7 +189,8 @@ def generate_feeds(posts, tag_set):
sitename=cfg['sitename'],
author=cfg['author'],
rooturl=cfg['rooturl'],
tagtitle=' • {0}'.format(tag)
tagtitle=' - {0}'.format(tag),
updated=updated
)
tagpath = path.join('tag', tag)
try:
Loading
Loading
Loading
Loading
@@ -2,12 +2,17 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<author>{{ author }}</author>
<title>{{ sitename }}{{ tagtitle }}</title>
<updated>{{ updated }}</updated>
{% for item in items %}
<entry>
<title>{{ item['title'] }}</title>
<link href="{{ rooturl }}{{ item['link'] }}"/>
<content type="html">{{ item['content'] }}</content>
<pubDate>{{ item['date'] }}</pubDate>
<content type="html">
<![CDATA[
{{ item['content'] }}
]]>
</content>
<published>{{ item['date'] }}</published>
</entry>
{% endfor %}
</feed>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment