Skip to content

Conversation

@KStocky
Copy link
Contributor

@KStocky KStocky commented Aug 14, 2025

When a layout template is using layouts/_partials/toc.html disabling 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

@netlify
Copy link

netlify bot commented Aug 14, 2025

Deploy Preview for hugo-hextra ready!

Name Link
🔨 Latest commit 205738d
🔍 Latest deploy log https://app.netlify.com/projects/hugo-hextra/deploys/68bdc5dda804c600093423a7
😎 Deploy Preview https://deploy-preview-749--hugo-hextra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Owner

@imfing imfing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@KStocky
Copy link
Contributor Author

KStocky commented Aug 14, 2025

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hiding whitespace will make this diff a lot clearer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants