From 317e9651c9913343646855b7ecda8e8516c6daf8 Mon Sep 17 00:00:00 2001 From: a Date: Sun, 11 Dec 2022 18:29:48 -0600 Subject: [PATCH] use details to only open current section in docs menu --- layouts/partials/nav-docs.html | 70 ++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/layouts/partials/nav-docs.html b/layouts/partials/nav-docs.html index c3b0656..764a27f 100644 --- a/layouts/partials/nav-docs.html +++ b/layouts/partials/nav-docs.html @@ -9,53 +9,44 @@ Skip menu {{ $currentPage := . }} {{ range .Site.Menus.docs }} - {{ if .HasChildren}} -
  • - + {{ $active := or ($currentPage.IsMenuCurrent "docs" .) (eq $currentPage.Section .Identifier)}} + {{ if .HasChildren }} +
    + {{ .Pre }} {{ .Name }} {{ .Post }} - +
    {{ else }}
  • - - {{ .Pre }} - {{ .Name }} - {{ .Post }} - -
  • - {{ end }} - {{ end }} - - - {{ else }} -
  • + class='{{- if $active }} active{{ end -}}'> {{ .Pre }} {{ .Name }} @@ -65,5 +56,18 @@ {{ end }} {{ end }} +
  • + {{ else }} +
  • + + {{ .Pre }} + {{ .Name }} + {{ .Post }} + +
  • + {{ end }} + {{ end }} + \ No newline at end of file