fix: disable nav tag for toc when toc is disabled#749
Open
KStocky wants to merge 4 commits intoimfing:mainfrom
Open
fix: disable nav tag for toc when toc is disabled#749KStocky wants to merge 4 commits intoimfing:mainfrom
KStocky wants to merge 4 commits intoimfing:mainfrom
Conversation
✅ Deploy Preview for hugo-hextra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
imfing
reviewed
Aug 14, 2025
Owner
imfing
left a comment
There was a problem hiding this comment.
I think it makes sense to completely remove the toc (including the nav tag) when it's not needed
however, this would break the layout for pages with the toc disabled, since the nav tag has been acting as a placeholder to maintain the layout spacing.
Maybe using the toc as a placeholder was a bad idea.. not sure if we should add a new parameter for the placeholder. Need to think about this a little more
Contributor
Author
|
Yeah, that is a fair point. I think a new parameter would be the best idea here to avoid a breaking change. Will update! |
…ameter that can be set via front matter. feat: added documentation for new front matter field
KStocky
commented
Aug 14, 2025
Contributor
Author
There was a problem hiding this comment.
Hiding whitespace will make this diff a lot clearer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a layout template is using
layouts/_partials/toc.htmldisabling toc on a page doesn't fully disable the toc. The nav tag is left there and is empty, which restricts the width of the content on the page unnecessarily.This change fixes that by removing the nav tag when the toc is disabled via frontmatter