{{- $showvisitedlinks := .Site.Params.showVisitedLinks }} {{- define "partials/inline/page-tree" }} {{- $currentNode := .currentnode }} {{- $config := .config }} {{- $showvisitedlinks := .showvisitedlinks }}
{{- with site.Home.GetPage ($config.pageRef | default "") }} {{- $entry := . }} {{- $entries := partialCached "_relearn/pages.gotmpl" (dict "page" $entry) $entry.Path }} {{- $title := "" }} {{- if not ($config.disableTitle | default true) }} {{ $title = $entry.Params.menuTitle | default (T (print $config.identifier "-menuTitle")) }} {{- end }} {{- with $title }} {{- end }} {{- $classes := "space " }} {{- if ($config.main | default true) }} {{- $classes = "enlarge morespace " }} {{- end }}
{{- else }} {{- warnf "WARNING: page '%s' not found for sidebar menu '%s'" ($config.pageRef | default "") $config.identifier }} {{- end }} {{- end }} {{- define "partials/inline/page-walker" }} {{- $currentNode := .currentnode }} {{- $showvisitedlinks := .showvisitedlinks }} {{- $alwaysopen := .alwaysopen }} {{- $isSelf := .isSelf }} {{- $isAncestor := .isAncestor }} {{- $isHidden := .isHidden }} {{- with .sect }} {{- $isActive := $isSelf }} {{- $entry := . }} {{- $entries := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }} {{- $hasVisibleChildren := false }} {{- range $entries }} {{- $isSubSelf := eq . $currentNode }} {{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }} {{- $isSubHidden := or (.Params.hidden) (eq .Title "") }} {{- if or $isSubAncestor $isSubSelf (not $isSubHidden) }} {{- $hasVisibleChildren = true }} {{- break }} {{- end }} {{- end }} {{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }} {{- $url := partial "permalink.gotmpl" (dict "to" .) }} {{- $pre := partial "menu-pre.html" . }} {{- $post := partial "menu-post.html" . }} {{- if $hasVisibleChildren }} {{- $isCollapsible := .Params.collapsibleMenu | default site.Params.collapsibleMenu }} {{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }} {{- if and (not $url) (not $isCollapsible) }} {{- $currentAlwaysopen = true }} {{- end }} {{- $entryId := md5 .Path }} {{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}
  • {{- if $isCollapsible }}{{ end }} {{- if $url }}{{ else }}{{ end }} {{- $pre }}{{ $title }}{{ $post }} {{- if $url }}{{ if $showvisitedlinks }}{{ end }}{{ else }}{{ end }}
  • {{- else if $url }}
  • {{- if $url }}{{ else }}{{ end }} {{- $pre }}{{ $title }}{{ $post }} {{- if $url }}{{ if $showvisitedlinks }}{{ end }}{{ else }}{{ end }}
  • {{- end }} {{- end }} {{- end }} {{- define "partials/inline/menu-tree" }} {{- $currentNode := .currentnode }} {{- $config := .config }} {{- $showvisitedlinks := .showvisitedlinks }} {{- with index site.Menus $config.identifier }}
    {{- $entry := "" }} {{- $entries := . }} {{- if eq (len $entries) 1 }} {{- with index $entries 0 }} {{- if not (partial "menupermalink.gotmpl" .) }} {{- /* because in Hugo menus can not have parameter but menu entries can, we can flag a single top level menu entry as a container; this container entry carrys just meta information and parameter, uses its children to build the "real" menu, and has no own `url` or `pageRef` */}} {{- $entry = . }} {{- $entries = .Children }} {{- end }} {{- end }} {{- end }} {{- $title := "" }} {{- if not ($config.disableTitle | default false) }} {{- if $entry }} {{- $title = partial "menutitle.gotmpl" $entry }} {{- else if eq $config.identifier "shortcuts" }} {{- if not site.Params.DisableShortcutsTitle }} {{- $title = T (print $config.identifier "-menuTitle") }} {{- end }} {{- else }} {{- $title = T (print $config.identifier "-menuTitle") }} {{- end }} {{- end }} {{- with $title }} {{- end }} {{- $classes := "space " }} {{- if ($config.main | default false) }} {{- $classes = "enlarge morespace " }} {{- end }}
    {{- else }} {{ if ne $config.identifier "shortcuts" }} {{- warnf "WARNING: menu '%s' not found for sidebar menu '%s'" $config.identifier $config.identifier }} {{- end }} {{- end }} {{- end }} {{- define "partials/inline/menu-walker" }} {{- $currentNode := .currentnode }} {{- $showvisitedlinks := .showvisitedlinks }} {{- $alwaysopen := .alwaysopen }} {{- $isSelf := .isSelf }} {{- $isAncestor := .isAncestor }} {{- $isHidden := .isHidden }} {{- $root := .root }} {{- with .menu }} {{- $isActive := $isSelf }} {{- $entry := . }} {{- $entries := .Children }} {{- $hasVisibleChildren := false }} {{- range $entries }} {{- $isSubSelf := eq .Page $currentNode }} {{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }} {{- $isSubHidden := or (.Params.hidden) (eq (partial "menutitle.gotmpl" .) "") }} {{- if or $isSubAncestor $isSubSelf (not $isSubHidden) }} {{- $hasVisibleChildren = true }} {{- break }} {{- end }} {{- end }} {{- $title := partial "menutitle.gotmpl" . }} {{- $url := partial "menupermalink.gotmpl" . }} {{- $pre := .Pre }} {{- $post := .Post }} {{- with .Page }} {{- $pre = or $pre (partial "menu-pre.html" .) }} {{- $post = or $post (partial "menu-post.html" .) }} {{- end }} {{- if $hasVisibleChildren }} {{- $isCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }} {{- $currentAlwaysopen := .Params.alwaysopen | default $root.Params.alwaysopen | default $alwaysopen }} {{- if and (not $url) (not $isCollapsible) }} {{- $currentAlwaysopen = true }} {{- end }} {{- $entryId := md5 (print .) }} {{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}
  • {{- if $isCollapsible }}{{ end }} {{- if $url }}{{ else }}{{ end }} {{- $pre }}{{ $title }}{{ $post }} {{- if $url }}{{ if $showvisitedlinks }}{{ end }}{{ else }}{{ end }}
  • {{- else if $url }}
  • {{- if $url }}{{ else }}{{ end }} {{- $pre }}{{ $title }}{{ $post }} {{- if $url }}{{ if $showvisitedlinks }}{{ end }}{{ else }}{{ end }}
  • {{- end }} {{- end }} {{- end }}