Stop collapsing on mobile
We recommend that if using the breadcrumbs for navigation purposes, you set collapse_on_mobile
to true
to make things more readable for mobile users. However, you can specify collapse_on_mobile:
false
or remove the flag completely to stop this behaviour.
How it looks (preview)
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"item": {
"name": "Home",
"@id": "https://www.gov.uk/"
}
},
{
"@type": "ListItem",
"position": 2,
"item": {
"name": "Passports, travel and living abroad",
"@id": "https://www.gov.uk/browse/abroad"
}
},
{
"@type": "ListItem",
"position": 3,
"item": {
"name": "Travel abroad",
"@id": "https://www.gov.uk/browse/abroad/travel-abroad"
}
}
]
}
</script>
<nav data-module="ga4-link-tracker" aria-label="Breadcrumb" class="gem-c-breadcrumbs govuk-breadcrumbs">
<ol class="govuk-breadcrumbs__list">
<li class="govuk-breadcrumbs__list-item">
<a data-ga4-link="{"event_name":"navigation","type":"breadcrumb","index_link":"1","index_total":"3"}" class="govuk-breadcrumbs__link" href="/">Home</a>
</li>
<li class="govuk-breadcrumbs__list-item">
<a data-ga4-link="{"event_name":"navigation","type":"breadcrumb","index_link":"2","index_total":"3"}" class="govuk-breadcrumbs__link" href="/browse/abroad">Passports, travel and living abroad</a>
</li>
<li class="govuk-breadcrumbs__list-item">
<a data-ga4-link="{"event_name":"navigation","type":"breadcrumb","index_link":"3","index_total":"3"}" class="govuk-breadcrumbs__link" href="/browse/abroad/travel-abroad">Travel abroad</a>
</li>
</ol>
</nav>
How to call this example
<%= render "govuk_publishing_components/components/breadcrumbs", {
collapse_on_mobile: false,
breadcrumbs: [
{
title: "Home",
url: "/"
},
{
title: "Passports, travel and living abroad",
url: "/browse/abroad"
},
{
title: "Travel abroad",
url: "/browse/abroad/travel-abroad"
}
]
} %>