Files
jacoblenz/src/includes/nav.njk
2024-05-10 11:20:00 +02:00

36 lines
1.1 KiB
Plaintext

{# From https://www.11ty.dev/docs/plugins/navigation/ #}
{% set navPages = collections.all | eleventyNavigation %}
{% macro renderNavListItem(entry) -%}
<li>
{% if not entry.children.length %}
<a {% if entry.url == page.url %} class="active"{% endif %} href="{{ entry.url }}">{{ entry.title }}</a>
{% if entry.status == "Abgeschlossen" %}
<span class="inline-block bg-slate-200 ml-1 px-1.5 rounded relative bottom-0.5 text-xs shadow-sm
align-bottom">Abgeschlossen</span>
{% elseif entry.status == "Laufend" %}
<span class="inline-block bg-slate-200 ml-1 px-1.5 rounded relative bottom-0.5 text-xs shadow-sm
align-bottom">in
Vorbereitung</span>
{% endif %}
{% else %}
<div>{{ entry.title }}</div>
{% endif %}
{%- if entry.children.length -%}
<ul>
{%- for child in entry.children %}
{{ renderNavListItem(child) }}
{% endfor -%}
</ul>
{%- endif -%}
</li>
{%- endmacro %}
<nav class="hidden-important desktop:!block py-4 sidebar-nav px-4" id="navigation">
<ul>
{%- for entry in navPages %}{{ renderNavListItem(entry) }}{%- endfor -%}
</ul>
</nav>