t-r.de/theme/templates/includes/navbar.html

39 lines
1.7 KiB
HTML

<nav role="navigation" data-breakpoint="my-md" id="site-navbar">
<ul>
<h2>{{ SITESUBTITLE }}</h2>
</ul>
<input type="checkbox" id="hamburger">
<label id="hamburger-label" for="hamburger" aria-label="Menu" aria-controls="main-menu-items">
&equiv;
</label>
<ul id="main-menu-items" role="list">
{% for title, link in MENUITEMS %}
{% if link is iterable and link is not string %}{% set submenu = true %}{% endif %}
{# aria-current tells the browser which menu link corresponds to the current page #}
<li role="listitem"{% if output_file[-10:] == "index.html" and (output_file[:-10] == link or (submenu and output_file[:-10] == link[0][1])) %} aria-current="page"{% endif %}{% if submenu %} aria-haspopup="menu"{% endif %}>
{% if submenu %}
<details class="dropdown">
<summary><a href="{{ SITEURL }}/{{ link[0][1]}}">{{ title }}</a></summary>
<ul>
{% for t, l in link %}
{# skip first submenu entry as it contains only the link for the summary (which has already been set) #}
{% if not loop.first %}
<li role="listitem"{% if output_file[-10:] == "index.html" and output_file[:-10] == l %} aria-current="page"{% endif %}><a href="{{ SITEURL }}/{{ l }}">{{ t }}</a></li>
{% endif %}
{% endfor %}
</ul>
</details>
{% else %}
<a href="{{ SITEURL }}/{{ link }}">{{ title }}</a>
{% endif %}
</li>
{% endfor %}
<li role="listitem" class="sun-moon-li">
<label id="sun-moon-label">
<input id="sun-moon" name="color-mode-toggle" role="switch" type="checkbox" value="1"
aria-label="Toggle Light or Dark Mode">
</label>
</li>
</ul>
</nav>
{# {% debug %} #}