From 60849fcdc60fbdcb29683dd7139ab61119e50e79 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 27 Aug 2021 00:00:15 +0200 Subject: [PATCH] Only show headers when there are 4 or more of them --- layouts/partials/content.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/layouts/partials/content.html b/layouts/partials/content.html index 33c936a..d14286a 100644 --- a/layouts/partials/content.html +++ b/layouts/partials/content.html @@ -12,9 +12,13 @@
{{ if .TableOfContents }} -
- {{ .TableOfContents }} -
+ + {{ $headers := findRE "(.|\n])+?" .Content }} + {{ if ge (len $headers) 4 }} +
+ {{ .TableOfContents }} +
+ {{ end }} {{ end }} {{ .Content }}