Hey guys, I’m trying to get the following output, where the ul id=“nav_desktop_werke” is only created underneath the li class=“menu-item-werke” when the url contains “werke” (sort of a dropwdown menu)
<nav id="nav_desktop" class="hidden">
<h1 class="logo"><a href="/">Fabian Widukind <br>Penzkofer</a></h1>
<ul>
<li class="menu-item-jetzt">
<a href="/">Jetzt</a>
<li class="menu-item-werke">
<a href="/werke/semiologien-meiner-künstlichen-welt.html">Werke</a>
<ul id="nav_desktop_werke">
<li>
<a href="/werke/semiologien-meiner-k%C3%BCnstlichen-welt.html">Semiologien meiner künstlichen Welt</a>
</li>
</ul>
<li class="menu-item-vita">
<a href="/vita.html">Vita</a>
<li class="menu-item-impressum/datenschutz">
<a href="/impressum.html">Impressum/Datenschutz</a>
</ul>
</nav>
I tried it with
<nav id="nav_desktop" class="hidden">
<h1 class="logo"><a href="/">Fabian Widukind <br>Penzkofer</a></h1>
<ul>
{% for item in site.menus.header %}
{%- if page.url contains "werke" -%}
<li class="menu-item-{{ item.title | downcase }}">
<a href="{{ item.url }}" {% if page.url == item.url %}class="current" {% endif %}>{{ item.title }}</a>
<ul id="nav_desktop_werke">
{%- for werk in sortedWerke -%}
<li>
<a href="{{ werk.url }}" {% if page.url contains werk.url %}class="current" {% endif %}>{{ werk.title }}</a>
</li>
</ul>
{%- endfor -%}
{%- else -%}
<li class="menu-item-{{ item.title | downcase }}">
<a href="{{ item.url }}" {% if page.url == item.url %}class="current" {% endif %}>{{ item.title }}</a>
</li>
{%- endif -%}
{%- endfor -%}
</ul>
</nav>
unfortunately I get something like
<nav id="nav_desktop" class="hidden">
<h1 class="logo"><a href="/">Fabian Widukind <br>Penzkofer</a></h1>
<ul>
<li class="menu-item-jetzt">
<a href="/">Jetzt</a>
<ul id="nav_desktop_werke">
<li>
<a href="/werke/semiologien-meiner-k%C3%BCnstlichen-welt.html">Semiologien meiner künstlichen Welt</a>
</li>
</ul>
<li class="menu-item-werke">
<a href="/werke/semiologien-meiner-künstlichen-welt.html">Werke</a>
<ul id="nav_desktop_werke">
<li>
<a href="/werke/semiologien-meiner-k%C3%BCnstlichen-welt.html">Semiologien meiner künstlichen Welt</a>
</li>
</ul>
<li class="menu-item-vita">
<a href="/vita.html">Vita</a>
<ul id="nav_desktop_werke">
<li>
<a href="/werke/semiologien-meiner-k%C3%BCnstlichen-welt.html">Semiologien meiner künstlichen Welt</a>
</li>
</ul>
<li class="menu-item-impressum/datenschutz">
<a href="/impressum.html">Impressum/Datenschutz</a>
<ul id="nav_desktop_werke">
<li>
<a href="/werke/semiologien-meiner-k%C3%BCnstlichen-welt.html">Semiologien meiner künstlichen Welt</a>
</li>
</ul>
</ul>
</nav>
Any Ideas?
Thanks
Seba