Is it possible to have the table of contents integrated with the page listings? For example, I have a left side navigation with 5 pages, when you click a page I’d like to show the TOC of that specific page. I don’t need help with the HTML but the logic of setting this up in Hugo.
Also, is it possible to customize the output of the TOC code?
I was hoping to create a left navigation that had links to 1-5, when I clicked on a specific link, that went to the specific page and expanded the menu showing the TOC of that page. So if I started on page 1, I’d see the TOC expanded under the 1 link, when I clicked to page 2, that would expand and show the TOC of that page.
Like I said, easier to help you with a site repo we can see. For example, I don’t know how you are rendering your navigation. Is this configured by Hugo Menus? Are you just listing out all the pages under docs?
If the second option, then you would do something like this:
{{ range where site.RegularPages "Section" "docs" }}
{{ .Permalink }}
{{ .TableOfContents }}
{{ end }}
Of course, adding the relevant HTML/CSS/JS is up to you.