Skip to content

Commit

Permalink
Add showBreadcrumbs option. Fixes #293
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Jul 22, 2024
1 parent a4e6bff commit 5481cb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ module.exports = function(eleventyConfig) {
{ text: "string" },
{ text: "Path to SCSS file, relative to input directory, containing [GOV.UK Frontend settings](https://frontend.design-system.service.gov.uk/sass-api-reference/) (default is `{dir.input}/sass/_settings.scss`)." | markdown }
],
[
{ text: "showBreadcrumbs" },
{ text: "boolean" },
{ text: "Show breadcrumb navigation (default is `true` with nested pages)." | markdown }
],
[
{ text: "stylesheets" },
{ text: "Array" },
Expand Down
2 changes: 1 addition & 1 deletion layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{% set breadcrumbItems = collections.all | eleventyNavigationBreadcrumb(eleventyNavigation.key, { includeSelf: includeInBreadcrumbs }) | itemsFromNavigation(page.url, options) if eleventyNavigation.key %}
{% set minimumItemsInBreadcrumbs = 0 %}
{% set minimumItemsInBreadcrumbs = 1 if options.parentSite %}
{% set showBreadcrumbs = breadcrumbItems | length > minimumItemsInBreadcrumbs %}
{% set showBreadcrumbs = options.showBreadcrumbs and breadcrumbItems | length > minimumItemsInBreadcrumbs %}

{# Components #}
{% from "govuk/components/breadcrumbs/macro.njk" import govukBreadcrumbs %}
Expand Down

0 comments on commit 5481cb5

Please sign in to comment.