Closed JonAugust closed 1 year ago
Thank you, @JonAugust -- this looks great. Thank you for the contribution! :slightly_smiling_face:
Thank you very much for merging this. (my first OS PR). I had a couple of questions:
Thanks again!
Congrats on your first OS PR! :tada:
To your first bullet point -- that was my bad. Being able to show/hide the ToC on a per-post basis makes sense to me. I'll probably keep the site-wide option too (in case someone doesn't want any ToC on their site), but also add the per-post option. Good catch!
To your second bullet point -- yes, this just removes unnecessary JavaScript. It only works at the site-wide level though (if you set hideToc: true
in your config.toml). Essentially, if someone doesn't want any ToC, then there's no need to download the JavaScript for it. This helps with page load times. The script is tiny, so it's not a huge boost in performance, but it's a small optimization nonetheless.
@JonAugust, I just merged this PR #112 to enable you to specify hideToc
on a per-post basis in the frontmatter. Hope it helps!
Let me know if you have any other questions/comments/suggestions. :+1:
@lukeorth This is perfect. Thank you for this!
This change allows a user to supply a tag in the frontmatter for a post that will disable the table of contents. For example:
hideToc: true
will disable the table of contents.
hideToc: false
will display the table of contents if you want to be explicit. I used the verb hide to facilitate cases where the flag is not explicitly set - which will be the case for all existing posts. The absence of the flag will display the table of contents.
If accepted and merged, this would close #110