From 3bcfa8936a44c981f87f2fa7571040a85dcb16cf Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Mon, 4 Apr 2022 23:25:24 -0700 Subject: [PATCH] feat: hide toc for short notes --- layouts/_default/single.html | 9 +-------- layouts/index.html | 9 +-------- layouts/partials/toc.html | 8 ++++++++ 3 files changed, 10 insertions(+), 16 deletions(-) create mode 100644 layouts/partials/toc.html diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 02965f91..88a859c3 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -22,14 +22,7 @@
  • {{ .LinkTitle | humanize }}
  • {{ end }} - {{ if (and $.Site.Data.config.enableToc (ne .Params.enableToc false)) }} - - {{end}} + {{partial "toc.html" .}} {{partial "textprocessing.html" . }} {{partial "footer.html" .}} diff --git a/layouts/index.html b/layouts/index.html index 466a05a3..ee33d7cc 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -13,14 +13,7 @@ {{partial "darkmode.html" .}}
    - {{ if (and $.Site.Data.config.enableToc (ne .Params.enableToc false)) }} - - {{end}} + {{partial "toc.html" .}} {{partial "textprocessing.html" . }}
    {{partial "footer.html" .}} diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html new file mode 100644 index 00000000..acda23d6 --- /dev/null +++ b/layouts/partials/toc.html @@ -0,0 +1,8 @@ +{{ if (and $.Site.Data.config.enableToc (ne .Params.enableToc false) (gt .WordCount 250)) }} + +{{end}}