From f5b7ee0a93676cd2e2ffc13d44ede28e500ab3f6 Mon Sep 17 00:00:00 2001 From: Ta-Ching Chen Date: Wed, 11 Mar 2020 16:29:33 +0800 Subject: [PATCH] Avoid printing unnecessary sections in sidelist --- assets/css/style.css | 16 ++-------------- layouts/partials/default.html | 34 ++++++++++++++-------------------- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/assets/css/style.css b/assets/css/style.css index 5fc9bda..92b56d4 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -763,7 +763,7 @@ tbody { /* side list */ .sidelist { - display: none; + display: block; } li.sidelist>a { @@ -776,18 +776,6 @@ li.sidelist li a { margin: 0; } -.sidelist.parent { - display: block; -} - -.sidelist.parent::before { - display: none; -} - -.sidelist.parent.active::before { - display: block; -} - .sidelist li.sidelist { display: block; } @@ -923,4 +911,4 @@ code { z-index: 1; left: -15px; top: -3px; -} \ No newline at end of file +} diff --git a/layouts/partials/default.html b/layouts/partials/default.html index 0932428..a694de3 100644 --- a/layouts/partials/default.html +++ b/layouts/partials/default.html @@ -8,8 +8,10 @@ {{ $currentNode := . }} {{ i18n "Back-home"}} {{range .Site.Home.Sections.ByWeight}} - {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode}} - {{end}} + {{ if eq . $currentNode.FirstSection }} {{/* print current section only */}} + {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode}} + {{ end }} + {{ end }} @@ -79,29 +81,21 @@ {{with .sect}} {{safeHTML .Params.head}}
  • + {{if eq .File.UniqueID $currentNode.File.UniqueID}}active{{end}}"> {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}} {{ $numberOfPages := (add (len .Pages) (len .Sections)) }} {{ if ne $numberOfPages 0 }} - + + {{ end }}
  • {{ end }} {{ end }} -{{ end }}