Feature: Table of contents in blog articles #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One can activate a table of contents for blog articles if the word count gets larger than a specified parameter.
New parameters in config.toml:
Additionally, one can deactivate the toc for single blog articles by adding tocActivated = false to the article config
Description
Motivation and Context
The code is based on the toc partial example from the Hugo documentation: https://gohugo.io/content-management/toc/
The change allows an user to automatically add a table of contents to a blog article if the article is longer than a defined word count and the corresponding tocIfNecessary option is switched on.
In addition a user can deactivate the toc generation for specific blog articles by adding a tocActivated = false setting.
How Has This Been Tested?
Tested on my own setup:
Hugo Version: 0.30.2
Browser(s): Firefox, Chromium, Chrome
Screenshots (if appropriate):
Types of changes
Checklist:
theme.toml
, accordingly.