mirror of
https://github.com/thegeeklab/hugo-geekdoc.git
synced 2024-11-23 05:10:39 +00:00
43 lines
1.4 KiB
HTML
43 lines
1.4 KiB
HTML
{{ $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" }}
|
|
{{ $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 }}
|