From d59c81398dd286781016cc45dbf4996f44fa02cb Mon Sep 17 00:00:00 2001 From: Joe Roe Date: Wed, 3 May 2023 15:11:00 +0200 Subject: [PATCH] Move TOC to sidebar --- exampleSite/config.toml | 9 +++++++++ layouts/_default/single.html | 7 ++++++- static/css/typography.css | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 7f899e5..be7f40c 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -63,6 +63,15 @@ series = "series" [markup.goldmark.renderer] unsafe = true +[markup] + + # Table of contents + # Add toc = true to content front matter to enable + [markup.tableOfContents] + startLevel = 2 + endLevel = 3 + ordered = true + [privacy] [privacy.vimeo] diff --git a/layouts/_default/single.html b/layouts/_default/single.html index dee40d1..77abf32 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,7 +4,6 @@ {{ if .Params.toc }} {{ end }}
@@ -21,4 +20,10 @@ {{ if .Date }}{{ .Date.Format "2006-01-02" }}{{ end }}

{{ end }} + + {{ if and (.Params.toc) (.TableOfContents) }} +
+ On this page: + {{ .TableOfContents }} + {{ end }} {{ end }} diff --git a/static/css/typography.css b/static/css/typography.css index a5e8d80..6369cf0 100644 --- a/static/css/typography.css +++ b/static/css/typography.css @@ -212,3 +212,4 @@ img { max-width: 100%; height: auto; } +