mirror of
https://github.com/Theodor-Springmann-Stiftung/jacoblenz.git
synced 2026-02-05 04:15:30 +00:00
Bessere Filtermöglichkeiten für Listen
This commit is contained in:
28
src/includes/nav.njk
Normal file
28
src/includes/nav.njk
Normal file
@@ -0,0 +1,28 @@
|
||||
{# 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.pdf == "yes" %}
|
||||
<span class="text-sm inline-block bg-slate-200 ml-1 px-1.5 rounded relative bottom-0.5">mit PDF</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 desktop:block py-4 sidebar-nav px-4" id="navigation">
|
||||
<ul>
|
||||
{%- for entry in navPages %}{{ renderNavListItem(entry) }}{%- endfor -%}
|
||||
</ul>
|
||||
</nav>
|
||||
Reference in New Issue
Block a user