Skip to content

Commit

Permalink
Add information about structured data in breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Mar 4, 2024
1 parent c790137 commit 55ff6ec
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion layouts/partials/breadcrumbs.njk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
<div class="tna-container">
<div class="tna-column tna-column--full">
{{ tnaBreadcrumbs({
items: breadcrumbs
items: breadcrumbs,
structuredData: true
}) }}
</div>
</div>
Expand Down
8 changes: 8 additions & 0 deletions src/components/breadcrumbs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ By default, the breadcrumbs will collapse on smaller devices to only show the fi
You can configure the breadcrumbs to never collapse by setting the `noCollapse` option to `true` or by adding the class `tna-breadcrumbs--no-collapse` to the main breadcrumbs element.

{{ example({ group: "components", item: "breadcrumbs", example: "no-collapse", html: true, nunjucks: true, size: "xxs", nunjucksOptions: false }) }}

## Using structured data

Enable structured data by setting the `structuredData` option to `true`. This will output additional markup that allows search engines to parse more information about your page.

{{ example({ group: "components", item: "breadcrumbs", example: "structured-data", html: true, nunjucks: true, size: "xxs", nunjucksOptions: false }) }}

Google provides ways to [test your structured data](https://developers.google.com/search/docs/appearance/structured-data).
32 changes: 32 additions & 0 deletions src/components/breadcrumbs/structured-data/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Breadcrumbs
layout: layout-example.njk
---

{% from "nationalarchives/components/breadcrumbs/macro.njk" import tnaBreadcrumbs %}

{{ tnaBreadcrumbs({
items: [
{
text: "Alpha",
href: "#/alpha"
},
{
text: "Beta",
href: "#/beta"
},
{
text: "Gamma",
href: "#/gamma"
},
{
text: "Delta",
href: "#/delta"
},
{
text: "Epsilon",
href: "#/epsilon"
}
],
structuredData: true
}) }}

0 comments on commit 55ff6ec

Please sign in to comment.