From 75a5c6e6fcce4ab46b8c423b614b69a914dc009d Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Wed, 7 Aug 2024 12:01:48 -0400 Subject: [PATCH] Improve warning msg, clean up whitespace excess --- layouts/partials/sidebar-tree.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/layouts/partials/sidebar-tree.html b/layouts/partials/sidebar-tree.html index 3d3b2b27b8..ab80b2a201 100644 --- a/layouts/partials/sidebar-tree.html +++ b/layouts/partials/sidebar-tree.html @@ -50,7 +50,11 @@ {{ $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 -}} -{{ if ge (len $pages_tmp) $sidebarMenuTruncate -}}{{ warnf "Warning: Some ToC entries won't be displayed on %s. Increase [params.ui.sidebar_menu_truncate] in your config file to avoid that. " $s -}}{{ end -}} +{{ $truncatedEntryCount := sub (len $pages_tmp) $sidebarMenuTruncate -}} +{{ if gt $truncatedEntryCount 0 -}} + {{ warnf "WARNING: %d sidebar entries have been truncated. To avoid this, increase `params.ui.sidebar_menu_truncate` to at least %d (from %d) in your config file. Section: %s" + $truncatedEntryCount (len $pages_tmp) $sidebarMenuTruncate $s.Path -}} +{{ end -}} {{ $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 -}} @@ -72,4 +76,4 @@ {{- end }} -{{- end }} +{{- end -}}