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