Table of content on an article #97
-
I am using Statiq with Clean blog theme and I saw in the documentation that it could be possible for each post to have a table of content of the post based on its headlines. The idea would be to display this toc at the beginning of the article or on the side of the article. Does somebody know where I could find some example of doing such a thing ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
When I was playing with this, I ended up doing this through some razor code. It never ended up in my final project, but the debugging class that shows how I did it still exists. Also, be sure to set I should also point out that this only works with markdown pages. Razor pages are not supported since not all of them are valid html documents on their own. Some are C# scripts or partials. See also #58 |
Beta Was this translation helpful? Give feedback.
When I was playing with this, I ended up doing this through some razor code.
It never ended up in my final project, but the debugging class that shows how I did it still exists. Also, be sure to set
GatherHeadingsLevel
to a value of higher equal to the deepest header (h1 being 1, h2 being 2, and so on) in your global config.I should also point out that this only works with markdown pages. Razor pages are not supported since not all of them are valid html documents on their own. Some are C# scripts or partials.
See also #58