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

archive improvements

This commit is contained in:
Bastian Venthur
2021-01-19 22:17:19 +01:00
parent 08d05f8bb3
commit a70b51cebb
4 changed files with 39 additions and 5 deletions

View File

@@ -177,7 +177,7 @@ def convert_to_html(convertibles):
ctx['archive'] = archive ctx['archive'] = archive
template = env.get_template('archive.html') template = env.get_template('archive.html')
result = template.render(ctx) result = template.render(ctx)
with open('archive.html', 'w') as fh: with open('build/archive.html', 'w') as fh:
fh.write(result) fh.write(result)
## generate tags ## generate tags

View File

@@ -1,5 +1,13 @@
<ul> <h1>Archive</h1>
{% for entry in archive %} {% for entry in archive %}
<li><a href="{{entry.dst}}">{{entry.title}}</a></li>
{% if entry.title %}
<h1><a href="{{entry.dst}}">{{entry.title}}</a></h1>
{% endif %}
{% if entry.date %}
<p>Written on {{ entry.date.date() }}.</p>
{% endif %}
{% endfor %} {% endfor %}
</ul>

26
templates/archive.html Normal file
View File

@@ -0,0 +1,26 @@
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}
{% block content %}
<h1>Archive</h1>
{% for entry in archive %}
{% if entry.title %}
<h1><a href="{{entry.dst}}">{{entry.title}}</a></h1>
{% endif %}
{% if entry.date %}
<p>Written on {{ entry.date.date() }}.</p>
{% endif %}
{% endfor %}
{% endblock %}

View File

@@ -18,7 +18,7 @@
<nav> <nav>
<ul> <ul>
<li><a href="/">Blog</a></li> <li><a href="/">Blog</a></li>
<li><a href="/archives.html">Archive</a></li> <li><a href="/archive.html">Archive</a></li>
<li><a href="/tags.html">Tags</a></li> <li><a href="/tags.html">Tags</a></li>
<li><a href="https://venthur.de/pages/about-me.html">About&nbsp;Me</a></li> <li><a href="https://venthur.de/pages/about-me.html">About&nbsp;Me</a></li>
</ul> </ul>