Groups notes by year and month

This commit is contained in:
2025-05-24 09:25:38 +01:00
parent 4ad17f126b
commit a8b6d8674b
2 changed files with 129 additions and 6 deletions

View File

@@ -3,12 +3,41 @@
{% block content %}
<section>
<h1>Notes</h1>
<p>
Skip to:
<ul>
{% for year in years %}
<li><a href="#{{ year }}">{{ year }}</a></li>
{% endfor %}
</ul>
</p>
{% for note in notes %}
<h2><a href="/notes/{{ note.slug }}">Note {{ note.slug }}</a></h2>
{% apply markdown_to_html %}
{{ note.content }}
{% endapply %}
{% for year in years %}
<h2 id="{{ year }}">{{ year }}</h2>
<p>
Skip to:
<ul>
{% for month in months[year] %}
<li><a href="#{{ year }}-{{ month }}">{{ monthNames[month] }} {{ year }}</a></li>
{% endfor %}
</ul>
</p>
{% for month in months[year] %}
<h3 id="{{ year }}-{{ month }}">{{ monthNames[month] }}</h3>
{% for note in notes[year][month] %}
<h4><a href="/notes/{{ note.slug }}">Note {{ note.slug }}</a></h4>
<time datetime="{{ note.publishedDate.format('c') }}">
{{ note.publishedDate.format('j F Y') }}
</time>
{% apply markdown_to_html %}
{{ note.content }}
{% endapply %}
{% endfor %}
{% endfor %}
{% else %}
<p>I have no notes.</p>
{% endfor %}