volpe/tags.njk

48 lines
No EOL
1.1 KiB
Text

---
pagination:
data: collections.contentByTag
size: 1
alias: tag
addAllPagesToCollections: true
permalink: /tags/{{ tag }}/
layout: base.njk
---
<h1>Content tagged "#{{ collections.contentByTag[tag].name }}"</h1>
{% set tagData = collections.contentByTag[tag] %}
{% if tagData.posts.length > 0 %}
<h2>Posts</h2>
<ul class="post-list">
{% for post in tagData.posts %}
<li>
<a href="{{ post.url }}" class="post-card">
<h2>{{ post.data.title }}</h2>
<time datetime="{{ post.date | dateTimeFormat }}">{{ post.date | dateTimeFormat }}</time>
{% if post.data.description %}
<p>{{ post.data.description }}</p>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if tagData.recipes.length > 0 %}
<h2>Recipes</h2>
<ul class="post-list">
{% for recipe in tagData.recipes %}
<li>
<a href="/recipe/{{ recipe.data.recipeSlug }}/" class="post-card">
<h2>{{ recipe.data.title }}</h2>
{% if recipe.data.description %}
<p>{{ recipe.data.description }}</p>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
<p><a href="/tags/">← All tags</a></p>