diff --git a/sg/sg.py b/sg/sg.py index 5e22711..e34ae5c 100644 --- a/sg/sg.py +++ b/sg/sg.py @@ -155,7 +155,21 @@ def convert_to_html(convertibles): with open('atom.xml', 'w') as fh: feed.write(fh, encoding='utf8') + # 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 if __name__ == '__main__': diff --git a/sg/templates/archive.html b/sg/templates/archive.html new file mode 100644 index 0000000..fb5971f --- /dev/null +++ b/sg/templates/archive.html @@ -0,0 +1,5 @@ +