From b1fa203e3a91398f9dbc3010fefe8777a777d440 Mon Sep 17 00:00:00 2001 From: S Nitesh Singh Date: Mon, 19 Jul 2021 11:13:18 +0530 Subject: [PATCH] fixing the huge white space in sidebar --- layouts/partials/sidebar-tree.html | 108 ++++++++++++++--------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/layouts/partials/sidebar-tree.html b/layouts/partials/sidebar-tree.html index 5e909e778f9..f1a3c9926a2 100644 --- a/layouts/partials/sidebar-tree.html +++ b/layouts/partials/sidebar-tree.html @@ -1,14 +1,14 @@ {{/* We cache this partial for bigger sites and set the active class client side. */}} -{{ $sidebarCacheLimit := cond (isset .Site.Params.ui "sidebar_cache_limit") .Site.Params.ui.sidebar_cache_limit 2000 }} -{{ $shouldDelayActive := ge (len .Site.Pages) $sidebarCacheLimit }} +{{ $sidebarCacheLimit := cond (isset .Site.Params.ui "sidebar_cache_limit") .Site.Params.ui.sidebar_cache_limit 2000 -}} +{{ $shouldDelayActive := ge (len .Site.Pages) $sidebarCacheLimit -}}
- {{ if not .Site.Params.ui.sidebar_search_disable }} + {{ if not .Site.Params.ui.sidebar_search_disable -}} - {{ else }} + {{ else -}}
- {{ end }} + {{ end -}}
-{{ define "section-tree-nav-section" }} - {{ $s := .section }} - {{ $p := .page }} - {{ $shouldDelayActive := .shouldDelayActive }} - {{ $sidebarMenuTruncate := .sidebarMenuTruncate }} - {{ $treeRoot := cond (eq .ulNr 0) true false }} - {{ $ulNr := .ulNr }} - {{ $ulShow := .ulShow }} - {{ $active := and (not $shouldDelayActive) (eq $s $p) }} - {{ $activePath := and (not $shouldDelayActive) ($p.IsDescendant $s) }} - {{ $show := cond (or (lt $ulNr $ulShow) $activePath (and (not $shouldDelayActive) (eq $s.Parent $p.Parent)) (and (not $shouldDelayActive) (eq $s.Parent $p)) (and (not $shouldDelayActive) ($p.IsDescendant $s.Parent))) true false }} - {{ $mid := printf "m-%s" ($s.RelPermalink | anchorize) }} - {{ $pages_tmp := where (union $s.Pages $s.Sections).ByWeight ".Params.toc_hide" "!=" true }} - {{ $pages := $pages_tmp | first $sidebarMenuTruncate }} - {{ $withChild := gt (len $pages) 0 }} - {{ $manualLink := cond (isset $s.Params "manuallink") $s.Params.manualLink ( cond (isset $s.Params "manuallinkrelref") (relref $s $s.Params.manualLinkRelref) $s.RelPermalink) }} - {{ $manualLinkTitle := cond (isset $s.Params "manuallinktitle") $s.Params.manualLinkTitle $s.Title }} +{{ define "section-tree-nav-section" -}} + {{ $s := .section -}} + {{ $p := .page -}} + {{ $shouldDelayActive := .shouldDelayActive -}} + {{ $sidebarMenuTruncate := .sidebarMenuTruncate -}} + {{ $treeRoot := cond (eq .ulNr 0) true false -}} + {{ $ulNr := .ulNr -}} + {{ $ulShow := .ulShow -}} + {{ $active := and (not $shouldDelayActive) (eq $s $p) -}} + {{ $activePath := and (not $shouldDelayActive) ($p.IsDescendant $s) -}} + {{ $show := cond (or (lt $ulNr $ulShow) $activePath (and (not $shouldDelayActive) (eq $s.Parent $p.Parent)) (and (not $shouldDelayActive) (eq $s.Parent $p)) (and (not $shouldDelayActive) ($p.IsDescendant $s.Parent))) true false -}} + {{ $mid := printf "m-%s" ($s.RelPermalink | anchorize) -}} + {{ $pages_tmp := where (union $s.Pages $s.Sections).ByWeight ".Params.toc_hide" "!=" true -}} + {{ $pages := $pages_tmp | first $sidebarMenuTruncate -}} + {{ $withChild := gt (len $pages) 0 -}} + {{ $manualLink := cond (isset $s.Params "manuallink") $s.Params.manualLink ( cond (isset $s.Params "manuallinkrelref") (relref $s $s.Params.manualLinkRelref) $s.RelPermalink) -}} + {{ $manualLinkTitle := cond (isset $s.Params "manuallinktitle") $s.Params.manualLinkTitle $s.Title -}}
  • - {{ if (and $p.Site.Params.ui.sidebar_menu_foldable (ge $ulNr 1)) }} + {{ if (and $p.Site.Params.ui.sidebar_menu_foldable (ge $ulNr 1)) -}} - {{ else }} + {{ else -}} {{ if not $treeRoot }} {{ with $s.Params.Icon}}{{ end }}{{ $s.LinkTitle }} - {{ end }} - {{ end }} - {{if $withChild }} - {{ $ulNr := add $ulNr 1 }} + {{ end -}} + {{ end -}} + {{ if $withChild -}} + {{ $ulNr := add $ulNr 1 -}} - {{ end }} + {{- end }}
  • -{{ end }} +{{- end }}