uci-doc/layouts/partials/menu-bundle.html

43 lines
1.4 KiB
HTML
Raw Normal View History

2020-01-12 06:33:02 -08:00
{{ $current := .current }}
{{ template "menu-file" dict "sect" .source "current" $current "site" $current.Site }}
{{ define "menu-file" }}
{{ $current := .current }}
{{ $site := .site }}
<ul class="gdoc-nav__list">
{{ range sort (default (seq 0) .sect) "weight" "desc" }}
{{ $current.Scratch.Set "current" $current }}
{{ $current.Scratch.Set "site" $site }}
<li>
{{ $ref := default false .ref }}
{{ if $ref}}
{{ $site := $current.Scratch.Get "site" }}
{{ $this := $site.GetPage .ref }}
{{ $current := $current.Scratch.Get "current" }}
{{ $icon := default false .icon }}
<span class="flex">
{{ if $icon }}<svg class="icon {{ .icon }}"><use xlink:href="#{{ .icon }}"></use></svg>{{ end }}
<a href="{{ if .external }}{{ .ref }}{{ else }}{{ relref $current .ref }}{{ end }}"
class="gdoc-nav__entry {{ if not .external }}{{ if eq $current $this }}is-active{{ end }}{{ end }}">
{{ .name }}
</a>
</span>
{{ else }}
<span class="flex">
{{ .name }}
</span>
{{ end }}
{{ $sub := default false .sub }}
{{ if $sub }}
{{ template "menu-file" dict "sect" $sub "current" ($current.Scratch.Get "current") "site" ($current.Scratch.Get "site") }}
{{ end }}
</li>
{{ end }}
</ul>
{{ end }}