<!-- Header -->
<header id="header" {{- if .IsHome -}}class="alt"{{- end -}}>
    <h1>{{ with .Site.Data.globalheader.title }}{{ . | markdownify }}{{else}}{{ .Site.Title }}{{end}}</h1>
    <nav id="nav">
        <ul>
<!-- iterate over menu entries -->
{{ range $menu_key, $menu_item := .Site.Menus }}
                <li id="{{ $menu_key }}">
{{   if eq (len $menu_item) 1 }}
                  <!-- a single menu entry, no sub menu must be builded -->
                  <a href="{{ default '#' (index $menu_item 0).URL }}" class="icon solid">{{ (index $menu_item 0).Identifier }}</a>
{{   else }}
                  <!-- use the first entry for the menu title -->
{{     range $idx, $val := $menu_item }}
{{       if eq $idx 0 }}
                  <a href="{{ default '#' .URL }}" class="icon solid fa-angle-down">{{ .Identifier }}</a>
{{       end }}
{{     end }}
                  <!-- build the sub menu -->
                <ul>
{{     range $idx, $val := $menu_item }}
{{       if gt $idx 0 }}
                    <li>
                          <a href="{{ .URL | relURL }}">{{ .Name }}</a>
                    </li>
{{       end }}
{{     end }}
                </ul>
{{   end }}


            </li>
{{ end }}
        </ul>
    </nav>
</header>
