dsrkafuu / hugo-theme-fuji

A minimal Hugo theme with nice theme color. | 一ä¸Ēä¸ģéĸ˜č‰˛æžįŽ€ Hugo ä¸ģéĸ˜ã€‚
https://github.dsrkafuu.net/hugo-theme-fuji/
Apache License 2.0
367 stars 97 forks source link

Enable TOC in a single post, with TOC disabled by default #61

Closed dantecatalfamo closed 3 years ago

dantecatalfamo commented 3 years ago

Hello,

Thank you for maintaining this theme, I've been using it for several months now and it's been amazing!

Previously I have had showToc disabled by default, and enabled it on certain posts. It looks like the new TOC logic stops posts with showToc = true in the front matter from generating a TOC if they're disabled in the global config. Enabling TOC by default and disabling it in the front matter of all other posts currently works, but seems like a messy solution.

Is it possible to enable TOC per-post again?

Thanks again! 😄

dsrkafuu commented 3 years ago

@dantecatalfamo Thanks for choosing the theme!

This is actually a bug where showToc=true is not working as expected. I've fixed it in the latest commit, you can upgrade the theme and try again with showToc=false in global and showToc=true in front matters.

The right logic: fixed setting status site showToc is undefined or true site showToc is false
page showToc is undefined ✅ ❎
page showToc is true ✅ ✅
page showToc is false ❎ ❎