From 8fea19a04b7a82d1b329b2828c4d0d0d3b2549e8 Mon Sep 17 00:00:00 2001 From: Rob Hoes Date: Mon, 5 Nov 2018 16:35:58 +0000 Subject: [PATCH] Menu: only expand active hierarchy Before this change, the entire menu tree below the selected top-level heading was expanded. This change adds some triangles on menu items at level 2 and below to indicate which ones can be or are expanded. I didn't put them on the top level, because I felt that it looked too cluttered and didn't add much value. Fixes #88 --- layouts/partials/menu.html | 13 ++++++++++--- static/css/theme.css | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index 3a409321649..8e89b55ab74 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -97,18 +97,25 @@

{{ if not $disableShortcutsTitle}}{{ T "Shortcuts-Title"}}{{ end }}

{{with .sect}} {{if .IsSection}} {{safeHTML .Params.head}} + {{ $isParent := or (.IsAncestor $currentNode) (.Params.alwaysopen) }} + {{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
  • {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}} + {{ if and (ne $numberOfPages 0) (ne .Parent .Site.Home) }} + {{if $isParent }} + + {{ else }} + + {{ end }} + {{ end }} {{ if $showvisitedlinks}} {{ end }} - {{ $numberOfPages := (add (len .Pages) (len .Sections)) }} {{ if ne $numberOfPages 0 }}