</h2>
{{- with index site.Menus $menuID }}
<ul id="submenu" class="s selected">
- {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
+ {{- partial "inline/menu/tree.html" (dict "pages" $page.Site.MainSections "current $page) }}
</ul>
{{- end }}
</ul>
<hr class="n"/>
</nav>
-{{- define "_partials/inline/menu/walk.html" }}
- {{- $page := .page }}
- {{- range .menuEntries }}
- {{- $attrs := dict "href" .URL }}
- {{- if $page.IsMenuCurrent .Menu . }}
- {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }}
- {{- else if $page.HasMenuCurrent .Menu .}}
- {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }}
- {{- end }}
- {{- $name := .Name }}
- {{- with .Identifier }}
- {{- with T . }}
- {{- $name = . }}
- {{- end }}
- {{- end }}
- <li class="s sub"><!-- sub? off? -->
- <a
- {{- range $k, $v := $attrs }}
- {{- with $v }}
- {{- printf " %s=%q" $k $v | safeHTMLAttr }}
- {{- end }}
- {{- end -}}
- >{{ $name }}</a>
- {{- with .Children }}
- <ul class="submenu"><!-- selected? -->
- {{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
- </ul>
+{{- define "_partials/inline/menu/tree.html" }}
+{{- $current := .current -}}
+{{- $pages := .pages -}}
+
+<ul class="page-tree">
+ {{- range $pages }}
+ {{- $isCurrent := $current.IsCurrent . -}}
+ {{- $isAncestor := $current.IsAncestor . -}}
+
+ <li
+ class="
+ page-tree__item
+ {{ if $isCurrent }} is-current{{ end }}
+ {{ if $isAncestor }} is-ancestor{{ end }}
+ "
+ >
+ <a href="{{ .RelPermalink }}">
+ {{ .Title }}
+ </a>
+
+ {{- if .Pages }}
+ {{- partial "tree.html" (dict
+ "pages" .Pages
+ "current" $current
+ ) }}
{{- end }}
</li>
{{- end }}
+</ul>
{{- end }}