From 2a99951897d45e65b775d5d25a46679a0083e603 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 27 Dec 2020 20:08:16 +0100 Subject: [PATCH] Add support for TOC partial. --- README.adoc | 4 ++++ layouts/_default/single.html | 2 ++ layouts/partials/toc.html | 1 + 3 files changed, 7 insertions(+) create mode 100644 layouts/partials/toc.html diff --git a/README.adoc b/README.adoc index cc8dd59..39393bb 100644 --- a/README.adoc +++ b/README.adoc @@ -7,6 +7,7 @@ :uri-opengraph: http://ogp.me/ :uri-schema: https://schema.org/ :uri-twittercards: https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards.html +:uri-hugo-doc-toc: https://gohugo.io/content-management/toc :uri-tomorrow-pygments: https://github.com/mozmorris/tomorrow-pygments *nocolor* is a link:{uri-hugo}[Hugo] theme with no predefined colors and minimal @@ -40,6 +41,9 @@ template `extra-head.html` or above the footer by overwriting `layouts/partials/extra_head.html` or `layouts/partials/extra_foot.html`, respectively. +To add a TOC to your pages, add `layouts/partials/toc.html` as described in +link:{uri-hugo-doc-toc}[the Hugo documentation]. + If you want source code highlighting, take a look at link:{uri-tomorrow-pygments}[tomorrow-pygments]. diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 7c723c1..4c8c0f2 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,5 +2,7 @@

{{ if .Draft }}DRAFT: {{ end }}{{ .Title }}

{{ partial "post_meta.html" . }} +{{ partial "toc.html" . }} +
{{ .Content }}
{{- end }} diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html new file mode 100644 index 0000000..1a31bfa --- /dev/null +++ b/layouts/partials/toc.html @@ -0,0 +1 @@ +