forked from github/pelican
feat: yearly archives, restructure headings
This commit is contained in:
parent
bfed925127
commit
310fab5496
11 changed files with 120 additions and 19 deletions
|
|
@ -4,13 +4,26 @@
|
|||
|
||||
{% block content %}
|
||||
<div class="md:text-base lg:text-lg">
|
||||
<h2>Blog archive</h2>
|
||||
<h1 class="text-3xl md:text-5xl">Blog archive</h1>
|
||||
<ul class="hyphens-auto list-outside list-disc">
|
||||
|
||||
<dl class="hyphens-auto">
|
||||
{% for article in dates %}
|
||||
<dt>{{ article.locale_date }}</dt>
|
||||
<dd><a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a></dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
{% for article in dates %}
|
||||
{% set year = article.date.strftime('%Y') %}
|
||||
{% if loop.first %}
|
||||
<h2 class="text-2xl md:text-3xl mt-6 mb-2" id="{{year }}"><a href="#{{year}}">{{ year }}</a></h2>
|
||||
{% else %}
|
||||
{% set prevyear = loop.previtem.date.strftime('%Y') %}
|
||||
{% if prevyear != year %}
|
||||
<h2 class="text-2xl md:text-3xl mt-6 mb-2" id="{{year }}"><a href="#{{year}}">{{ year }}</a></h2>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% set month = article.date.strftime('%m') %}
|
||||
{% set day = article.date.strftime('%d') %}
|
||||
<li>{{ article.locale_date }}: <a href="{{ SITEURL }}/{{ article.url }}#content">{{ article.title }}</a></li>
|
||||
{%if article.subtitle %}
|
||||
{{ article.subtitle }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue