Sorry for bumping this olf thread but is it really not possible?
I’m using https://github.com/matcornic/hugo-theme-learn/ and wonder how to add a TOC to a site.’
Edit: Org. asked in Insert table of content in markdown.
Sorry for bumping this olf thread but is it really not possible?
I’m using https://github.com/matcornic/hugo-theme-learn/ and wonder how to add a TOC to a site.’
Edit: Org. asked in Insert table of content in markdown.
Hey, you can just start a new thread and link to the old one.
Anyhow, what do you mean by that? Have you read the https://gohugo.io/content-management/toc/? The original topic was about loading them as shortcodes. The TOC is added to the rendering template for a given piece of content.
Thx for your reply!
Okay, thx for splitting the threads!
Thx, maybe I understand the original request wrong. My question is: Is the possibility to create a TOC for a site something theme specific or something that works overall?
I’m asking because I could find very basic information how to format text in GitHub - matcornic/hugo-theme-learn: Porting Grav Learn theme to Hugo in its documentation (something like “how to make text bold”) but no information how to create a TOC. So I wondered if this is something not all themes support or if it was forgotten to mention in the documentation.
I read the document at Pages organization :: Documentation for Hugo Learn Theme and found:
# Table of content (toc) is enabled by default. Set this parameter to true to disable it.
# Note: Toc is always disabled for chapter pages
disableToc = "false"
So that theme supports a table of contents. Before we get into adding it (which is explained on the former link), you should figure out the deal with the theme you’re using. Do you have a page with headings that isn’t a chapter? If so, it should show a TOC.
Thx @maiki for your help.
Do you have a page with headings that isn’t a chapter? If so, it should show a TOC.
As far as I understood the documentation provided by your link every page is a non-chapter page (called “default” page) as long as I don’t provide chapter = true
.
This is the case for all my pages (no chapter = true
given) but I haven’t a TOC in any of my pages.
To get more help you need to share your code. Your guess is as good as mine, without me seeing what you are doing.
A post was split to a new topic: TOC inside shortcode?
For others puzzling over this, the learn theme does generate a TOC, but it’s hidden behind an icon to the left of the breadcrumbs.