From 06c0e206d178d4f11f00b3814761582ea60a718c Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Wed, 8 Mar 2023 14:53:36 +0100 Subject: [PATCH] Incorporating reviewer feedback --- layouts/partials/sidebar-tree.html | 15 +++------------ layouts/partials/sidebar.html | 10 ++-------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/layouts/partials/sidebar-tree.html b/layouts/partials/sidebar-tree.html index 7f02010082..bebd3b59e0 100644 --- a/layouts/partials/sidebar-tree.html +++ b/layouts/partials/sidebar-tree.html @@ -1,8 +1,5 @@ {{/* We cache this partial for bigger sites and set the active class client side. */ -}} -{{ $sidebarCacheLimit := 2000 -}} -{{ with .Site.Params.ui.sidebar_cache_limit -}} - {{ $sidebarCacheLimit = . -}} -{{ end -}} +{{ $sidebarCacheLimit := .Site.Params.ui.sidebar_cache_limit | default 2000 -}} {{ $shouldDelayActive := ge (len .Site.Pages) $sidebarCacheLimit -}}
{{ if not .Site.Params.ui.sidebar_search_disable -}} @@ -29,14 +26,8 @@ {{ end -}} {{ $navRoot := cond (and (ne .Params.toc_root true) (eq .Site.Home.Type "docs")) .Site.Home .FirstSection -}} {{ $ulNr := 0 -}} - {{ $ulShow := 1 -}} - {{ with .Site.Params.ui.ul_show -}} - {{ $ulShow = . -}} - {{ end -}} - {{ $sidebarMenuTruncate := 50 -}} - {{ with .Site.Params.ui.sidebar_menu_truncate -}} - {{ $sidebarMenuTruncate = . -}} - {{ end -}} + {{ $ulShow := .Site.Params.ui.ul_show | default 1 -}} + {{ $sidebarMenuTruncate := .Site.Params.ui.sidebar_menu_truncate | default 50 -}} diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 2e4a268c44..83e149f30b 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -1,13 +1,7 @@ {{/* The "active" toggle here may delay rendering, so we only cache this side bar menu for bigger sites. */ -}} -{{ $sidebarCacheLimit := 2000 -}} -{{ with .Site.Params.ui.sidebar_cache_limit -}} - {{ $sidebarCacheLimit = . -}} -{{ end -}} +{{ $sidebarCacheLimit := .Site.Params.ui.sidebar_cache_limit | default 2000 -}} {{ $shouldCache := ge (len .Site.Pages) $sidebarCacheLimit -}} -{{ $sidebarCacheTypeRoot := false -}} -{{ with .Site.Params.ui.sidebar_cache_type_root -}} - {{ $sidebarCacheTypeRoot = . -}} -{{ end -}} +{{ $sidebarCacheTypeRoot := .Site.Params.ui.sidebar_cache_type_root | default false -}} {{ if $shouldCache -}} {{ $mid := printf "m-%s" (.RelPermalink | anchorize) }}