diff options
Diffstat (limited to 'layouts/partials/recursive_nav.html')
-rw-r--r-- | layouts/partials/recursive_nav.html | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/layouts/partials/recursive_nav.html b/layouts/partials/recursive_nav.html new file mode 100644 index 0000000..4a3ed2c --- /dev/null +++ b/layouts/partials/recursive_nav.html @@ -0,0 +1,12 @@ +{{ $currentPage := .currentPage }} +<ul> + {{ range .pages }} + {{ $isCurrentOrAncestor := or (eq $currentPage .) ($currentPage.IsDescendant .) }} + <li {{ if eq $currentPage . }}class="nav-current"{{ end }}> + <a href="{{ .RelPermalink }}">{{ .Title }}</a> + </li> + {{ if and .Pages $isCurrentOrAncestor }} + {{ partial "recursive_nav.html" (dict "currentPage" $currentPage "pages" .Pages) }} + {{ end }} + {{ end }} +</ul> |