github.com/square/finch@v0.0.0-20240412205204-6530c03e2b96/docs/themes/hugo-geekdoc/layouts/partials/menu-bundle.html (about) 1 {{ $current := .current }} 2 {{ template "menu-file" dict "sect" .source "current" $current "site" $current.Site }} 3 4 5 <!-- template --> 6 {{ define "menu-file" }} 7 {{ $current := .current }} 8 {{ $site := .site }} 9 10 11 <ul class="gdoc-nav__list"> 12 {{ range sort (default (seq 0) .sect) "weight" }} 13 {{ $name := .name }} 14 {{ if reflect.IsMap .name }} 15 {{ $name = (index .name $site.Language.Lang) }} 16 {{ end }} 17 18 19 <li> 20 {{ $ref := default false .ref }} 21 {{ if $ref }} 22 {{ $this := $site.GetPage .ref }} 23 {{ $icon := default false .icon }} 24 {{ $numberOfPages := (add (len $this.Pages) (len $this.Sections)) }} 25 {{ $isCurrent := eq $current $this }} 26 {{ $isAncestor := $this.IsAncestor $current }} 27 {{ $id := substr (sha1 $this.Permalink) 0 8 }} 28 {{ $doCollapse := and (isset . "sub") (or $this.Params.GeekdocCollapseSection (default false .Site.Params.GeekdocCollapseAllSections)) }} 29 30 {{ $anchor := default "" .anchor }} 31 {{ if $anchor }} 32 {{ $anchor = printf "#%s" $anchor }} 33 {{ end }} 34 35 {{ if or .external ($this.RelPermalink) }} 36 <input 37 type="checkbox" 38 {{ if $doCollapse }} 39 class="gdoc-nav__toggle" id="{{ printf "navtree-%s" $id }}" 40 {{ if or $isCurrent $isAncestor }}checked{{ end }} 41 {{ else }} 42 class="hidden" 43 {{ end }} 44 /> 45 <label 46 {{ if $doCollapse }} 47 for="{{ printf "navtree-%s" $id }}" class="flex justify-between align-center" 48 {{ end }} 49 > 50 <span class="flex"> 51 {{ if $icon }} 52 <svg class="gdoc-icon {{ .icon }}"><use xlink:href="#{{ .icon }}"></use></svg> 53 {{ end }} 54 <a 55 href="{{ if .external }} 56 {{ .ref }} 57 {{- else -}} 58 {{ path.Join $this.RelPermalink $anchor }} 59 {{- end }}" 60 class="gdoc-nav__entry{{- if not .external }} 61 {{- if $isCurrent }}{{ printf " is-active" }}{{ end }} 62 {{- end }}" 63 > 64 {{ $name }} 65 </a> 66 </span> 67 {{ if $doCollapse }} 68 <svg class="gdoc-icon toggle gdoc_keyboard_arrow_left"> 69 <use xlink:href="#gdoc_keyboard_arrow_left"></use> 70 </svg> 71 <svg class="gdoc-icon toggle gdoc_keyboard_arrow_down hidden"> 72 <use xlink:href="#gdoc_keyboard_arrow_down"></use> 73 </svg> 74 {{ end }} 75 </label> 76 {{ end }} 77 {{ else }} 78 <span class="flex">{{ $name }}</span> 79 {{ end }} 80 81 {{ with .sub }} 82 {{ template "menu-file" dict "sect" . "current" $current "site" $site }} 83 {{ end }} 84 </li> 85 {{ end }} 86 </ul> 87 {{ end }}