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