{{ $sections := where site.Sections "Section" "docs" }} {{ $here := .RelPermalink }} {{ $section := .CurrentSection }} {{ $metaLinks := site.Menus.meta }} {{/* Iterate through all docs sections, including the root */}} {{ range $sections }}
{{ template "heading" (dict "here" $here "url" .RelPermalink "title" (.Params.short | default .Title )) }} {{ with .Sections }} {{ range . }} {{ template "section" (dict "ctx" . "here" $here "section" $section) }} {{ end }} {{ end }} {{ end }} {{/* Extra "meta" links specified in config.toml (external links outside our doc tree) */}}
{{ template "heading" (dict "title" "Meta" "hover" false) }}
{{ template "meta-menu" $metaLinks }}
{{ define "section" }} {{ $here := .here }} {{ $section := .section }}
{{ template "heading" (dict "here" $here "url" .ctx.RelPermalink "title" (.ctx.Params.short | default .ctx.Title )) }}
{{ range .ctx.Pages }} {{ if .IsPage }} {{ template "link" (dict "here" $here "url" .RelPermalink "title" (.Params.short | default .Title)) }} {{ else if .IsSection }} {{ template "subsection-group" (dict "ctx" . "here" $here "section" $section) }} {{ end }} {{ end }}
{{ end }} {{ define "subsection-group" }} {{ $here := .here }} {{ $section := .section }} {{ $open := .ctx.IsAncestor $section }}
{{ template "link" (dict "here" $here "url" .ctx.RelPermalink "title" (.ctx.Params.short | default .ctx.Title)) }} {{ template "chevron-icon" }}
{{ with .ctx.Sections }} {{ range . }} {{ template "subsection-group" (dict "ctx" . "here" $here "section" $section) }} {{ end }} {{ end }} {{ with .ctx.RegularPages }} {{ range . }} {{ template "link" (dict "here" $here "url" .RelPermalink "title" (.Params.short | default .Title )) }} {{ end }} {{ end }}
{{ end }} {{ define "heading" }} {{ $isActive := eq .here .url }} {{ if .url }} {{ .title }} {{ else }}

{{ .title }}

{{ end }} {{ end }} {{ define "link" }} {{ $isActive := eq .here .url }} {{ .title }} {{ end }} {{ define "chevron-icon" }} {{/* Heroicon: outline/chevron-right */}} {{ end }} {{ define "meta-menu" }} {{ range . }}

{{ .Name }} {{/* Heroicon: outline/external-link */}}

{{ end }} {{ end }}