hugo-geekdoc/layouts/partials/menu-filetree.html

49 lines
2.0 KiB
HTML
Raw Normal View History

2020-01-12 14:33:02 +00:00
{{ $current := . }}
{{ template "tree-nav" dict "sect" .Site.Home.Sections "current" $current }}
<!-- templates -->
{{ define "tree-nav" }}
{{ $current := .current }}
<ul class="gdoc-nav__list">
2020-02-05 15:46:29 +00:00
{{ range .sect.GroupBy "Weight" }}
2020-01-12 14:33:02 +00:00
{{ range .ByTitle }}
2020-11-11 10:48:25 +00:00
{{ if not .Params.GeekdocHidden }}
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
{{ $isParent := and (ne $numberOfPages 0) (not .Params.GeekdocFlatSection) }}
{{ $isCurrent := eq $current . }}
{{ $isAncestor := .IsAncestor $current }}
{{ $id := substr (sha1 .Permalink) 0 8 }}
{{ $doCollapse := and $isParent (or .Params.GeekdocCollapseSection (default false .Site.Params.GeekdocCollapseAllSections)) }}
2020-01-12 14:33:02 +00:00
<li>
{{ if $doCollapse }}
<input type="checkbox" id="{{ printf "navtree-%s" $id }}" class="gdoc-nav__toggle" {{ if or $isCurrent $isAncestor }}checked{{ end }}>
<label for="{{ printf "navtree-%s" $id }}" class="flex justify-between">
{{ end }}
2020-11-11 10:48:25 +00:00
{{ if or .Content .Params.GeekdocFlatSection }}
2020-01-12 14:33:02 +00:00
<span class="flex">
<a href="{{ .RelPermalink }}" class="gdoc-nav__entry {{ if eq $current . }}is-active{{ end }}">
{{ partial "title" . }}
</a>
</span>
{{ else }}
<span class="flex">{{ partial "title" . }}</span>
{{ end }}
{{ if $doCollapse }}
<svg class="icon gdoc_keyborad_arrow_left"><use xlink:href="#gdoc_keyborad_arrow_left"></use></svg>
<svg class="icon gdoc_keyborad_arrow_down hidden"><use xlink:href="#gdoc_keyborad_arrow_down"></use></svg>
</label>
{{ end }}
2020-01-12 14:33:02 +00:00
{{ if $isParent }}
2020-01-12 14:33:02 +00:00
{{ template "tree-nav" dict "sect" .Pages "current" $current}}
{{ end }}
</li>
{{ end }}
2020-01-12 14:33:02 +00:00
{{ end }}
{{ end }}
</ul>
{{ end }}