{{ $current := . }}
{{ $site := .Site }}
{{ $current.Scratch.Set "prev" false }}
{{ $current.Scratch.Set "getNext" false }}
{{ $current.Scratch.Set "nextPage" false }}
{{ $current.Scratch.Set "prevPage" false }}
{{ template "menu-filetree-np" dict "sect" .Site.Home.Sections "current" $current "site" $site }}
{{ define "menu-filetree-np" }}
{{ $current := .current }}
{{ $site := .site }}
{{ $sortBy := (default "title" .current.Site.Params.geekdocFileTreeSortBy | lower) }}
{{ range .sect.GroupBy "Weight" }}
{{ $rangeBy := .ByTitle }}
{{ if eq $sortBy "title" }}
{{ $rangeBy = .ByTitle }}
{{ else if eq $sortBy "linktitle" }}
{{ $rangeBy = .ByLinkTitle }}
{{ else if eq $sortBy "date" }}
{{ $rangeBy = .ByDate }}
{{ else if eq $sortBy "publishdate" }}
{{ $rangeBy = .ByPublishDate }}
{{ else if eq $sortBy "expirydate" }}
{{ $rangeBy = .ByExpiryDate }}
{{ else if eq $sortBy "lastmod" }}
{{ $rangeBy = .ByLastmod }}
{{ else if eq $sortBy "title_reverse" }}
{{ $rangeBy = .ByTitle.Reverse }}
{{ else if eq $sortBy "linktitle_reverse" }}
{{ $rangeBy = .ByLinkTitle.Reverse }}
{{ else if eq $sortBy "date_reverse" }}
{{ $rangeBy = .ByDate.Reverse }}
{{ else if eq $sortBy "publishdate_reverse" }}
{{ $rangeBy = .ByPublishDate.Reverse }}
{{ else if eq $sortBy "expirydate_reverse" }}
{{ $rangeBy = .ByExpiryDate.Reverse }}
{{ else if eq $sortBy "lastmod_reverse" }}
{{ $rangeBy = .ByLastmod.Reverse }}
{{ end }}
{{ range $rangeBy }}
{{ $current.Scratch.Set "current" $current }}
{{ $current.Scratch.Set "site" $site }}
{{ if not .Params.geekdocHidden }}
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
{{ $site := $current.Scratch.Get "site" }}
{{ $this := . }}
{{ $current := $current.Scratch.Get "current" }}
{{ $current.Scratch.Set "refName" (partial "utils/title" .) }}
{{ $name := $current.Scratch.Get "refName" }}
{{ if $current.Scratch.Get "getNext" }}
{{ if $this.Content }}
{{ $current.Scratch.Set "nextPage" (dict "name" $name "this" $this) }}
{{ $current.Scratch.Set "getNext" false }}
{{ end }}
{{ end }}
{{ if eq $current.RelPermalink $this.RelPermalink }}
{{ $current.Scratch.Set "prevPage" ($current.Scratch.Get "prev") }}
{{ $current.Scratch.Set "getNext" true }}
{{ end }}
{{ if $this.Content }}
{{ $current.Scratch.Set "prev" (dict "name" $name "this" $this) }}
{{ end }}
{{ $sub := and (ne $numberOfPages 0) (not .Params.geekdocFlatSection) }}
{{ if $sub }}
{{ template "menu-filetree-np" dict "sect" .Pages "current" $current }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ with ($current.Scratch.Get "prevPage") }}
gdoc_arrow_left_alt
{{ .name }}
{{ end }}
{{ with ($current.Scratch.Get "nextPage") }}
{{ .name }}
gdoc_arrow_right_alt
{{ end }}