github.com/square/finch@v0.0.0-20240412205204-6530c03e2b96/docs/themes/hugo-geekdoc/layouts/partials/menu-extra.html (about)

     1  {{ $current := .current }}
     2  {{ template "menu-extra" dict "sect" .source "current" $current "site" $current.Site "target" .target }}
     3  
     4  
     5  <!-- template -->
     6  {{ define "menu-extra" }}
     7    {{ $current := .current }}
     8    {{ $site := .site }}
     9    {{ $target := .target }}
    10    {{ $sect := .sect }}
    11  
    12    {{ range sort (default (seq 0) $sect) "weight" }}
    13      {{ if isset . "ref" }}
    14        {{ $this := $site.GetPage .ref }}
    15        {{ $isCurrent := eq $current $this }}
    16        {{ $icon := default false .icon }}
    17  
    18        {{ $name := .name }}
    19        {{ if reflect.IsMap .name }}
    20          {{ $name = (index .name $site.Language.Lang) }}
    21        {{ end }}
    22  
    23        {{ if not .icon }}
    24          {{ errorf "Missing 'icon' attribute in data file for '%s' menu item '%s'" $target $name }}
    25        {{ end }}
    26  
    27        {{ if eq $target "header" }}
    28          <span>
    29            <a
    30              href="{{ if .external }}
    31                {{ .ref }}
    32              {{ else }}
    33                {{ relref $current .ref }}
    34              {{ end }}"
    35              class="gdoc-header__link"
    36            >
    37              <svg class="gdoc-icon {{ .icon }}">
    38                <title>{{ $name }}</title>
    39                <use xlink:href="#{{ .icon }}"></use>
    40              </svg>
    41            </a>
    42          </span>
    43        {{ end }}
    44      {{ end }}
    45    {{ end }}
    46  {{ end }}