2021-08-12 09:17:49 -07:00
|
|
|
{{ $current := .current }}
|
|
|
|
{{ template "menu-extra" dict "sect" .source "current" $current "site" $current.Site "target" .target }}
|
|
|
|
|
2022-01-06 04:58:10 -08:00
|
|
|
|
2021-08-12 09:17:49 -07:00
|
|
|
<!-- template -->
|
|
|
|
{{ define "menu-extra" }}
|
2022-01-06 04:58:10 -08:00
|
|
|
{{ $current := .current }}
|
|
|
|
{{ $site := .site }}
|
|
|
|
{{ $target := .target }}
|
|
|
|
{{ $sect := .sect }}
|
2021-08-12 09:17:49 -07:00
|
|
|
|
2022-01-06 04:58:10 -08:00
|
|
|
{{ range sort (default (seq 0) $sect) "weight" }}
|
2021-08-12 09:17:49 -07:00
|
|
|
{{ if isset . "ref" }}
|
2022-01-06 04:58:10 -08:00
|
|
|
{{ $this := $site.GetPage .ref }}
|
|
|
|
{{ $isCurrent := eq $current $this }}
|
|
|
|
{{ $icon := default false .icon }}
|
2021-08-12 09:17:49 -07:00
|
|
|
|
2022-01-23 04:21:44 -08:00
|
|
|
{{ if reflect.IsMap .name }}
|
|
|
|
{{ $current.Scratch.Set "refName" (index .name $site.Language.Lang) }}
|
|
|
|
{{ else }}
|
|
|
|
{{ $current.Scratch.Set "refName" .name }}
|
|
|
|
{{ end }}
|
|
|
|
{{ $name := $current.Scratch.Get "refName" }}
|
|
|
|
|
2022-01-06 04:58:10 -08:00
|
|
|
{{ if not .icon }}
|
2022-01-23 04:21:44 -08:00
|
|
|
{{ errorf "Missing 'icon' attribute in data file for '%s' menu item '%s'" $target $name }}
|
2022-01-06 04:58:10 -08:00
|
|
|
{{ end }}
|
2021-08-12 09:17:49 -07:00
|
|
|
|
2022-01-06 04:58:10 -08:00
|
|
|
{{ if eq $target "header" }}
|
2021-10-15 02:50:11 -07:00
|
|
|
<span>
|
2022-01-06 04:58:10 -08:00
|
|
|
<a
|
|
|
|
href="{{ if .external }}
|
|
|
|
{{ .ref }}
|
|
|
|
{{ else }}
|
|
|
|
{{ relref $current .ref }}
|
|
|
|
{{ end }}"
|
|
|
|
class="gdoc-header__link"
|
|
|
|
>
|
2021-08-12 09:17:49 -07:00
|
|
|
<svg class="icon {{ .icon }}">
|
2022-01-23 04:21:44 -08:00
|
|
|
<title>{{ $name }}</title>
|
2022-01-06 04:58:10 -08:00
|
|
|
<use xlink:href="#{{ .icon }}"></use>
|
2021-08-12 09:17:49 -07:00
|
|
|
</svg>
|
2022-01-06 04:58:10 -08:00
|
|
|
</a>
|
2021-10-15 02:50:11 -07:00
|
|
|
</span>
|
2022-01-06 04:58:10 -08:00
|
|
|
{{ end }}
|
2021-08-12 09:17:49 -07:00
|
|
|
{{ end }}
|
2022-01-06 04:58:10 -08:00
|
|
|
{{ end }}
|
2021-08-12 09:17:49 -07:00
|
|
|
{{ end }}
|