From f9e72c9d4cb98b27ebcaae3d78fdbd52ecbfcd04 Mon Sep 17 00:00:00 2001 From: Adam Ormsby Date: Thu, 12 Mar 2020 23:16:33 +0700 Subject: [PATCH 1/3] add basic table of contents --- layouts/_default/single.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index b58ef9a..53cab35 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -40,6 +40,10 @@ {{ end }}
+ {{ if .Params.Toc }} +

Table of Contents

+ + {{ end }} {{ .Content }}
{{ if eq .Type $.Site.Params.contentTypeName }} From dab37f7e537df47f20e0c986e2e602298ba27aca Mon Sep 17 00:00:00 2001 From: Adam Ormsby Date: Thu, 12 Mar 2020 23:28:53 +0700 Subject: [PATCH 2/3] udpate readme --- README.md | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index b3eefdc..0742298 100644 --- a/README.md +++ b/README.md @@ -10,21 +10,23 @@ This theme is pretty basic and covers all of the essentials. All you have to do --- -- [Features](#features) -- [Built-in shortcodes](#built-in-shortcodes) -- [Code highlighting](#code-highlighting) -- [How to start](#how-to-start) -- [How to configure](#how-to-configure) -- [How to add a cover image to your posts](#how-to-add-a-cover-image-to-your-posts) -- [How to display the Last Modified Date in your posts](#how-to-display-the-last-modified-date-in-your-posts) -- [How to hide "Read more" button](#how-to-hide-read-more-button) -- [Add-ons](#add-ons) -- [How to run your site](#how-to-run-your-site) -- [How to edit the theme](#how-to-edit-the-theme) -- [How to contribute](#how-to-contribute) -- [Hello Friend theme user?](#hello-friend-theme-user) -- [Sponsoring](#sponsoring) -- [Licence](#licence) +- [Hello Friend](#hello-friend) + - [DEMO - https://hugo-hello-friend.now.sh/](#demo---httpshugo-hello-friendnowsh) + - [Features](#features) + - [Built-in shortcodes](#built-in-shortcodes) + - [Code highlighting](#code-highlighting) + - [How to start](#how-to-start) + - [How to configure](#how-to-configure) + - [How to add a cover image to your posts](#how-to-add-a-cover-image-to-your-posts) + - [How to display the Last Modified Date in your posts](#how-to-display-the-last-modified-date-in-your-posts) + - [How to hide "Read more" button](#how-to-hide-%22read-more%22-button) + - [Add-ons](#add-ons) + - [How to run your site](#how-to-run-your-site) + - [How to edit the theme](#how-to-edit-the-theme) + - [How to contribute](#how-to-contribute) + - [`Hello Friend` theme user?](#hello-friend-theme-user) + - [Sponsoring](#sponsoring) + - [License](#license) ## Features @@ -92,6 +94,10 @@ paginate = 5 # Show reading time in minutes for posts showReadingTime = false + # Show table of contents at the top of your posts (defaults to false) + # Alternatively, add this param to post front matter for specific posts + toc = true + [languages] [languages.en] title = "Hello Friend" From b1305f42faa90c405b1d39e6e46447606b28bf1e Mon Sep 17 00:00:00 2001 From: Adam Ormsby Date: Tue, 26 May 2020 18:48:26 -0500 Subject: [PATCH 3/3] add site param check --- layouts/_default/single.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 53cab35..f9370f9 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -40,7 +40,7 @@ {{ end }}
- {{ if .Params.Toc }} + {{ if or .Params.Toc $.Site.Params.Toc }}

Table of Contents

{{ end }}