added 2nd level menus to main navbar

This commit is contained in:
eclipse 2025-02-18 22:35:25 +01:00
parent d51d471c58
commit 0bbd922880
3 changed files with 58 additions and 16 deletions

View File

@ -42,11 +42,24 @@ RELATIVE_URLS = True
DISPLAY_PAGES_ON_MENU = DISPLAY_CATEGORIES_ON_MENU = False DISPLAY_PAGES_ON_MENU = DISPLAY_CATEGORIES_ON_MENU = False
MENUITEMS = ( MENUITEMS = (
("Werke", "werke/"), ("Werke", (
("", "werke/"),
("Romane", "romane/"),
("Kurzprosa", "kurzprosa"),
("Lyrik", "lyrik/")
)),
("Neues", "neues/"), ("Neues", "neues/"),
("Termine", "termine/"), ("Termine", (
("", "termine/"),
("Lesereihen", "lesereihen")
)),
("Autor", "autor/"), ("Autor", "autor/"),
("Kontakt", "kontakt/") ("Kontakt", (
("", "kontakt/"),
("Newsletter", "newsletter/"),
("Datenschutz", "datenschutz/"),
("Impressum", "impressum/"),
))
) )
IGNORE_FILES = ['**/.*'] IGNORE_FILES = ['**/.*']

View File

@ -179,22 +179,42 @@ a {
margin-left: 0; margin-left: 0;
margin-right: 0; margin-right: 0;
li:last-child { li.sun-moon-li {
padding-right: 0; padding-right: 0;
} }
li[aria-current=page] a { li[aria-current=page] a {
text-decoration: underline; text-decoration: underline;
} }
}
a { a {
font-size: calc(var(--pico-font-size) * 0.9); font-size: calc(var(--pico-font-size) * 0.9);
font-weight: bold; font-weight: bold;
text-align: right; text-align: right;
} }
details.dropdown {
margin-block-end: calc(var(--pico-spacing) * -1);
>summary:not([role]) a,
li a {
color: var(--pico-primary);
} }
>summary:not([role]) {
background-color: inherit;
border: none;
}
}
li a {
text-align: left;
}
}
}
/* make hamburger icon bigger */ /* make hamburger icon bigger */
#hamburger-label { #hamburger-label {
font-size: calc(var(--pico-font-size) * 2); font-size: calc(var(--pico-font-size) * 2);

View File

@ -8,16 +8,25 @@
</label> </label>
<ul id="main-menu-items" role="list"> <ul id="main-menu-items" role="list">
{% for title, link in MENUITEMS %} {% for title, link in MENUITEMS %}
{% if output_file[-10:] == "index.html" and output_file[:-10] == link %} {# 10 characters is the length of {% if link is iterable and link is not string %}{% set submenu = true %}{% endif %}
"index.html" #} <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 %}>
<li aria-current="page" role="listitem"> {% if submenu %}
{% else %} <details class="dropdown">
<li role="listitem"> <summary><a href="{{ SITEURL }}/{{ link[0][1]}}">{{ title }}</a></summary>
<ul>
{% for t, l in link %}
{% 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 %} {% endif %}
{% endfor %}
</ul>
</details>
{% else %}
<a href="{{ SITEURL }}/{{ link }}">{{ title }}</a> <a href="{{ SITEURL }}/{{ link }}">{{ title }}</a>
{% endif %}
</li> </li>
{% endfor %} {% endfor %}
<li role="listitem"> <li role="listitem" class="sun-moon-li">
<label id="sun-moon-label"> <label id="sun-moon-label">
<input id="sun-moon" name="color-mode-toggle" role="switch" type="checkbox" value="1" <input id="sun-moon" name="color-mode-toggle" role="switch" type="checkbox" value="1"
aria-label="Toggle Light or Dark Mode"> aria-label="Toggle Light or Dark Mode">