Open ilongshan opened 1 year ago
Hi,
Hugo can automatically do this -> https://gohugo.io/content-management/toc/
You can send a PR for the same :)
Thanks for the info. I am not a very familar with css, and cannot make TOC floating on the right side of the article. Hope someone else can implement this feature.
I've forked so I cannot do a PR quickly, but I've added these lines (14-18) to support TOC in posts: https://github.com/hcartiaux/hugo-theme-archie-solarized/blob/1115b97906be0ea5fd4daf8690e2fe41c901a135/layouts/_default/single.html#L14
Plus CSS here: https://github.com/hcartiaux/hugo-theme-archie-solarized/blob/1115b97906be0ea5fd4daf8690e2fe41c901a135/assets/css/main.css#L181
And then you can add toc: true
to your post headers to enable it: https://github.com/hcartiaux/hugo-theme-archie-solarized/blob/1115b97906be0ea5fd4daf8690e2fe41c901a135/exampleSite/content/posts/tg-gh.md?plain=1#L6
Hope it can add support to TOC, like hugo-theme-even:
https://hugo-theme-even.netlify.app/post/even-preview/