feat: support breadcrumbs for single pages that are neither docs or blogs (#743)

* feat: support breadcrumbs for single pages that are neither docs or blogs.

* feat: support enabling breadcrumbs across different content types other than docs and blog

docs: added docs and examples for enabling breadcrumbs for specific content types

* feat: breadcrumbs being enabled is fully driven by the `breadcrumbs` 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

* Removing _partials/utils/default-breadcrumbs-enabled.html in favour of extra parameterization of _partials/breadcrumb.html

* fix: change breadcrumbs parameter from `enabledByDefault` to `enable` to remain consistent with the rest of the theme

* Update layouts/_partials/breadcrumb.html

---------

Co-authored-by: Xin <5097752+imfing@users.noreply.github.com>
This commit is contained in:
Keith Stockdale
2025-08-26 20:46:51 +01:00
committed by GitHub
parent f9a94f02a6
commit bbffff1f52
8 changed files with 33 additions and 8 deletions

View File

@@ -180,9 +180,17 @@ This would now generate the following breadcrumbs:
Documentation > Guide > Foo Bar
```
### Hiding Breadcrumbs
### Enabling and Disabling Breadcrumbs
You can hide breadcrumbs completely from a page by specifying `breadcrumbs: false` in its front matter:
Whether breadcrumbs are enabled, or disabled, by default for a page, is determined by its [content type](https://gohugo.io/quick-reference/glossary/#content-type) and [page kind](https://gohugo.io/quick-reference/glossary/#page-kind):
| Content Type | Section | Page |
|:----------------|:--------:|:----------|
| `docs` | Enabled | Enabled |
| `blog` | Disabled | Enabled |
| Any other type | Disabled | Disabled |
You can override these defaults on a page by setting `breadcrumbs` in its front matter:
```yaml {filename="content/docs/guide/organize-files.md"}
---
@@ -191,6 +199,18 @@ title: Organize Files
---
```
Similarly you can use [cascade](https://gohugo.io/content-management/front-matter/#cascade-1) to override the defaults on a page and its decendents:
```yaml {filename="content/portfolio/_index.md"}
---
title: "Portfolio"
cascade:
params:
breadcrumbs: true
---
```
## Configure Content Directory
By default, the root `content/` directory is used by Hugo to build the site.