cmc/cleberg.net
My personal web garden & blog.
clone: git clone https://gitbay.org/cmc/cleberg.net.git
main: content/templates/blog.html · raw
1{# The blog index at /blog/.
2 Separate from list.html because the page carries its own prose. #}
3{% extends "base.html" %}
4
5{#- Group the list under year headings, as the live site does. Set to false for one flat
6 list; styles.css has .post-list-year either way. `page.year` comes from #+DATE:, and
7 a post without one lands in its own group at the end rather than being dropped. #}
8{%- set group_by_year = true %}
9
10{% block main %}
11<h1>{{ page.title }}</h1>
12<p>Use <code>⌘ F</code> / <code>Ctrl F</code> to search · <a href="{{ root }}feed.xml">RSS Feed</a></p>
13<p>Want to browse by topic instead? Head over to the <a href="{{ root }}tags/index.html">tags</a> page.</p>
14<ul class="post-list">
15{%- if group_by_year %}
16{%- for year, posts in pages | groupby("year") | reverse %}
17<li class="post-list-year">{{ year if year else "undated" }}</li>
18{%- for entry in posts %}
19<li class="post-list-item">
20{%- if entry.date_iso %}<time datetime="{{ entry.date_iso }}">{{ entry.date_iso }}</time>{% endif %}
21<a href="{{ root }}{{ entry.url }}">{{ entry.title }}</a>
22</li>
23{%- endfor %}
24{%- endfor %}
25{%- else %}
26{%- for entry in pages %}
27<li class="post-list-item">
28{%- if entry.date_iso %}<time datetime="{{ entry.date_iso }}">{{ entry.date_iso }}</time>{% endif %}
29<a href="{{ root }}{{ entry.url }}">{{ entry.title }}</a>
30</li>
31{%- endfor %}
32{%- endif %}
33</ul>
34{% endblock %}