zet.oliverdavies.uk/source/_layouts/note.html.twig
Oliver Davies 5baae90010 Show links to related posts
Enter note titles in `page.related` and add `use: [notes]` to include
links to related notes.
2024-09-14 13:59:36 +01:00

50 lines
979 B
Twig

{% extends "base" %}
{% block body %}
<nav>
<a href="/">Home</a>
</nav>
{{ parent() }}
{% endblock %}
{% block content_wrapper %}
<time date="{{ page.date|date('c') }}">{{ page.date|date }}</time>
{% block content %}{% endblock %}
{% if page.links is not empty %}
<h2>Links</h2>
<ul>
{% for url in page.links %}
<li><a href="{{ url }}">{{ url }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% if page.tags is not empty %}
<h2>Tags</h2>
<ul>
{% for tag in page.tags|sort %}
<li>{{ tag }}</li>
{% endfor %}
</ul>
{% endif %}
{% if page.related and data.notes %}
<section>
<h2>Related</h2>
<ul>
{% for note in data.notes if page.related|filter((title) => title == note.title) %}
<li>
<a href="{{ note.url|trim('/', 'right') }}">{{ note.title }}</a>
</li>
{% endfor %}
</ul>
</section>
{% endif %}
{% endblock %}