Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu: only expand active hierarchy (fixes #195) #355

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

oldenboom
Copy link

Pull request @robhoes is on older version of theme and required some work. Reviewed those edits, then used master to redo the edits to prepare this pull request.

@seekM
Copy link

seekM commented May 8, 2020

Is there a specific reason why this hasn't been merged yet?

@root360-AndreasUlm
Copy link

@oldenboom the following diff fixes the conflicts in menu.html:

diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html
index 5583eda..c023003 100644
--- a/layouts/partials/menu.html
+++ b/layouts/partials/menu.html
@@ -99,18 +99,25 @@
  {{with .sect}}
   {{if and .IsSection (or (not .Params.hidden) $.showhidden)}}
     {{safeHTML .Params.head}}
+    {{ $isParent := or (.IsAncestor $currentNode) (.Params.alwaysopen) }}
+    {{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
     <li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item 
-        {{if .IsAncestor $currentNode }}parent{{end}}
+        {{if $isParent }}parent{{end}}
         {{if eq .File.UniqueID $currentFileUniqueID}}active{{end}}
-        {{if .Params.alwaysopen}}parent{{end}}
         ">
       <a href="{{.RelPermalink}}">
           {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
+          {{ if and (ne $numberOfPages 0) (ne .Parent .Site.Home) }}
+            {{if $isParent }}
+              <i class="fas fa-caret-down"></i>
+            {{ else }}
+              <i class="fas fa-caret-right"></i>
+            {{ end }}
+          {{ end }}
           {{ if $showvisitedlinks}}
-            <i class="fas fa-check read-icon"></i>
+            <i class="fas fa-check"></i>
           {{ end }}
       </a>
-      {{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
       {{ if ne $numberOfPages 0 }}
         <ul>
           {{ $currentNode.Scratch.Set "pages" .Pages }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants