<a class="s selected" href="{{ site.Home.RelPermalink }}">Home</a>
</h2>
<ul id="submenu" class="submenu selected">
- {{- partial "inline/menu/tree.html" (dict "pages" $page.Site.Sections "page" $page "parent" site.Home) }}
+ {{- partial "inline/menu/tree.html" (dict "pages" $page.Site.Sections "page" $page) }}
{{- define "_partials/inline/menu/tree.html" }}
{{- $page := .page -}}
- {{- $parent := .parent -}}
{{- range .pages -}}
+ {{- $parent := index .Ancestors 0 -}}
{{- $isCurrent := eq . $page -}}
{{- $isAncestor := $page.IsDescendant . -}}
- <li class="s{{ if or .Pages .Sections}} sub{{ end }}{{ if not (or (eq $page .) ($page.IsDescendant .))}} off{{ end }}">
+ {{- $isChild := $parent.Eq $page }}
+ {{- $isSibling := $parent.Eq (index $page.Ancestors 0) }}
+ <li class="s{{ if or .Pages .Sections}} sub{{ end }}{{ if not (or $isAncestor $isSibling $isChild) }} off{{ end }}">
<!--
th:with="
child=${pos == len},
<a href="{{ .RelPermalink }}"
class="s {{ if (or $isCurrent $isAncestor) }} selected{{ end }}"
>{{ .Title }}</a>
+ <!-- .: {{ .Path }} -->
+ <!-- $parent: {{ $parent.Path }} -->
+ <!-- $page: {{ $page.Path }} -->
+ <!-- $isCurrent: {{ $isCurrent }} -->
+ <!-- $isAncestor: {{ $isAncestor }} -->
+ <!-- $isSibling: {{ $isSibling }} -->
+ <!-- $isChild: {{ $isChild }} -->
+ <!-- .Eq $page: {{ .Eq $page }} -->
+ <!-- .IsAncestor $page: {{ .IsAncestor $page }} -->
+ <!-- .IsDescendant $page: {{ .IsDescendant $page }} -->
{{ if or .Pages .Sections }}
<ul class="s{{ if (or $isCurrent $isAncestor) }} active{{ end }}">
{{- if .Pages }}
{{- partial "inline/menu/tree.html" (dict
"pages" .Pages
"page" $page
- "parent" .
) }}
{{- end }}
</ul>