From 8c4d7defca48e7de32bafdaae3cecd8a2223a998 Mon Sep 17 00:00:00 2001 From: Philip Mallegol-Hansen Date: Wed, 1 May 2024 13:58:51 -0700 Subject: [PATCH] Improves ToC logic to account for both site and page configuration --- layouts/partials/toc.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index 3d148a2..588d180 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -1,8 +1,12 @@ {{ $toc := true }} -{{ if isset .Site.Params "toc" }} - {{ $toc = .Site.Params.toc }} +{{ if isset .Params "toc" }} + {{ $toc = .Params.toc }} +{{ else }} + {{ $toc = ge .WordCount .Site.Params.tocWordCount }} + {{ if and (isset .Site.Params "toc") (not (.Site.Params.toc)) }} + {{ $toc = false }} + {{ end }} {{ end }} -{{ $toc = and ($toc) (ge .WordCount .Site.Params.tocWordCount) }} {{ if $toc }}