Skip to content

Conversation

@KStocky
Copy link
Contributor

@KStocky KStocky commented Aug 13, 2025

BREAKING CHANGE: since layouts/_partials/breadcumb.html will enable breadcrumbs by default, this is a breaking change. Sites that have pages that use layouts/single.html will get breadcrumbs by default on their pages with this change. They can disable the breadcrumbs with frontmatter, however.

@netlify
Copy link

netlify bot commented Aug 13, 2025

Deploy Preview for hugo-hextra ready!

Name Link
🔨 Latest commit 04448fb
🔍 Latest deploy log https://app.netlify.com/projects/hugo-hextra/deploys/68ae0e3f5501c2000809f869
😎 Deploy Preview https://deploy-preview-743--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.

Can you elaborate more on the necessity of this breaking change?

Curious about the use cases this change enables.

@KStocky
Copy link
Contributor Author

KStocky commented Aug 13, 2025

I have found myself either having to set the content layout of different archetypes of content to be docs or blog, or copy and pasting the blog single.html layout and adding this line to get breadcrumbs across my website.

I am not a huge fan of setting the content layout in front matter because the content is neither a blog or docs
Creating a new layout via copy and pasting isn't great either because it means that any updates made to the theme's layout won't be applied to those pages.

Additionally, I thought it would be good to have uniformity across the functionality of all single pages that this theme provides.

…er than docs and blog

docs: added docs and examples for enabling breadcrumbs for specific content types
@KStocky
Copy link
Contributor Author

KStocky commented Aug 15, 2025

Added a new site parameter, which now stops this from being a breaking change. Essentially, blog and docs content types have breadcrumbs enabled by default. Other content types can enable breadcrumbs by populating the params.breadcrumbs.contentTypes map in hugo.yaml, but they are disabled by default. Therefore, this is no longer a breaking change.

@imfing
Copy link
Owner

imfing commented Aug 15, 2025

Added a new site parameter, which now stops this from being a breaking change. Essentially, blog and docs content types have breadcrumbs enabled by default. Other content types can enable breadcrumbs by populating the params.breadcrumbs.contentTypes map in hugo.yaml, but they are disabled by default. Therefore, this is no longer a breaking change.

thanks for this, definitely on the right track!

I wonder if instead of a list targeting per content type, we could make breadcrumbs a simple bool param (default to false), enable it by default for docs & blog, and allow per-page toggling and overrides via cascade

@KStocky
Copy link
Contributor Author

KStocky commented Aug 15, 2025

I wonder if instead of a list targeting per content type, we could make breadcrumbs a simple bool param (default to false), enable it by default for docs & blog, and allow per-page toggling and overrides via cascade

Ah. That already exists, with hiding breadcrumbs.

The way breadcrumbs work without this PR, is that breadcrumbs are enabled by default for docs and blog but they can be disabled via front matter on a per-page basis.

This PR will allow other content types to opt in to the same functionality.

@imfing
Copy link
Owner

imfing commented Aug 15, 2025

I wonder if instead of a list targeting per content type, we could make breadcrumbs a simple bool param (default to false), enable it by default for docs & blog, and allow per-page toggling and overrides via cascade

Ah. That already exists, with hiding breadcrumbs.

The way breadcrumbs work without this PR, is that breadcrumbs are enabled by default for docs and blog but they can be disabled via front matter on a per-page basis.

This PR will allow other content types to opt in to the same functionality.

My thinking is we can keep the breadcrumb implementation in layouts/docs/single.html and leverage the existing breadcrumbs flag to enable it in a more flexible way, rather than adding a new configuration option

If we do so, we need to slightly modify the existing breadcrumbs enablement logic by making it default to false in default layouts

…front matter field.

docs: updated docs to reflect that there is no site parameter driving breadcrumbs

feat: enabled breadcrumbs for lists as well as singles for uniformity
@KStocky
Copy link
Contributor Author

KStocky commented Aug 15, 2025

My thinking is we can keep the breadcrumb implementation in layouts/docs/single.html and leverage the existing breadcrumbs flag to enable it in a more flexible way, rather than adding a new configuration option

Yup this is definitely a much nicer way of doing it. The code is cleaner, and it is more easily configurable.

Also enabled breadcrumbs in lists as well as singles since the docs lists.html gets breadcrumbs. I felt all lists.html should also have the option :)

@@ -0,0 +1,7 @@
{{ $ret := false }}
Copy link
Owner

Choose a reason for hiding this comment

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

this helper function partial is not needed

@@ -1,4 +1,4 @@
{{- if (default true .Params.breadcrumbs) }}
{{- if (default (partial "utils/default-breadcrumbs-enabled" .) .Params.breadcrumbs) }}
Copy link
Owner

Choose a reason for hiding this comment

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

we can make the partial accept parameters

so for docs/blogs we can pass in true and for other, we can pass in .Params.breadcrumbs and falls back to false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Though rather than passing in .Params.breadcrumbs I pass in a dict which contains the page and a bool called enabledByDefault. We need to pass in the page for the logic of the partial, and I didn't want callers of breadcrumb.html to be the ones to do the logic of combining the default and front matter parameters. So I left that logic inside the breadcrumb.html partial.

I can easily hoist that logic out, if you would prefer :)

@imfing imfing mentioned this pull request Aug 26, 2025
18 tasks
@imfing imfing added this to the v0.11.0 milestone Aug 26, 2025
@imfing
Copy link
Owner

imfing commented Aug 26, 2025

@KStocky thank you, great work!

@imfing imfing merged commit bbffff1 into imfing:main Aug 26, 2025
4 checks passed
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