1
0
mirror of https://github.com/venthur/blag.git synced 2025-11-25 20:52:43 +00:00

generate archive

This commit is contained in:
Bastian Venthur
2021-01-17 14:46:48 +01:00
parent f61e12910b
commit a7c93134b3
2 changed files with 19 additions and 0 deletions

View File

@@ -155,7 +155,21 @@ def convert_to_html(convertibles):
with open('atom.xml', 'w') as fh: with open('atom.xml', 'w') as fh:
feed.write(fh, encoding='utf8') feed.write(fh, encoding='utf8')
# generate archive # generate archive
ctx = {}
archive = []
for dst, context in articles:
entry = context.copy()
entry['dst'] = dst
archive.append(entry)
archive = sorted(archive, key=lambda x: x['date'], reverse=True)
ctx['archive'] = archive
template = env.get_template('archive.html')
result = template.render(ctx)
with open('archive.html', 'w') as fh:
fh.write(result)
# generate tags # generate tags
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -0,0 +1,5 @@
<ul>
{% for entry in archive %}
<li><a href="{{entry.dst}}">{{entry.title}}</a></li>
{% endfor %}
</ul>