From 3d600a74c3a34da6d2fa16013c82318c3c793c70 Mon Sep 17 00:00:00 2001 From: Junyi Hou Date: Wed, 6 Mar 2024 13:24:28 +0800 Subject: [PATCH 1/6] fix: the ToC shown on non-toc pages --- layouts/partials/toc.html | 21 ++++++++++++++++----- layouts/partials/toc.html.rej | 28 ++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 layouts/partials/toc.html.rej diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index d69fa77..c770f73 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -1,10 +1,21 @@ -{{ $toc := and ($.Site.Params.toc) (ge .WordCount $.Site.Params.tocWordCount) }} {{ if isset .Params "toc" }} {{ $toc = .Params.toc }} {{ end }} {{ if $toc }} -
- Table of Contents -
{{ .TableOfContents }}
-
+{{ $toc := and ($.Site.Params.toc) (ge .WordCount $.Site.Params.tocWordCount) }} +{{ if isset .Params "toc" }} + {{ $toc = .Params.toc }} +{{ end }} + + +{{ if $toc }} + {{ $tocContent := .TableOfContents }} + {{ if findRE "
  • " $tocContent }} + +
    + Table of Contents +
    {{ .TableOfContents }}
    +
    + {{ end }} {{ end }} +