add index pages for blog post tags

This commit is contained in:
maia arson crimew 2022-05-31 21:28:57 +02:00
parent d0cc73379f
commit 7e5840e15a
3 changed files with 34 additions and 4 deletions

View file

@ -14,7 +14,7 @@ subhead: blog
{% if tags %}
<span>in
{% for tag in tags %}
<span class="tag"><a href="#">{{ tag }}</a></span>{% if not loop.last %}, {% endif %}
<span class="tag"><a href="/posts/tagged/{{ tag }}/">{{ tag }}</a></span>{% if not loop.last %}, {% endif %}
{% endfor %}
</span>
{% endif %}

View file

@ -40,16 +40,19 @@ footer,
font-size: 0.75rem;
}
time, .author {
time,
.author {
font-weight: bold;
}
.article_header {
.article_header,
.page_header {
padding-bottom: 4px;
border-bottom: 1px dotted rgb(219, 103, 167);
}
.article_header > h1 {
.article_header > h1,
.page_header > h1 {
margin: 0.1rem;
}

27
src/tagged.njk Normal file
View file

@ -0,0 +1,27 @@
---
eleventyComputed:
title: posts tagged "{{ tag }}"
subhead: blog
pagination:
data: collections
size: 1
alias: tag
filter:
- posts
addAllPagesToCollections: true
permalink: /posts/tagged/{{ tag }}/index.html
---
{% extends 'layouts/default.njk' %}
{% block main %}
<header class="page_header">
<h1>posts tagged "{{ tag }}"</h1>
</header>
<ul>
{% set taglist = collections[ tag ] %}
{% for entry in taglist | reverse %}
<li>
<span><a href="{{ entry.url }}">{{ entry.data.title }}</a> on <span><time datetime="{{ entry.date | date_to_datetime }}">{{ entry.date | date_formatted }}</time></span></span>
</li>
{% endfor %}
</ul>
{% endblock %}