We're off to DotAll 2022 in Brooklyn NY (plus a little extra sightseeing time). Our support will be limited.

Breadcrumbs#

craft.navigation.breadcrumbs(options)#

You can retrieve a list of breadcrumbs based on the current URL. They are not based on your navigation items, and instead use the current URL segments. The function will look up any element that matches the URI for the segment. If not found, the segment itself will be used.

{% for crumb in craft.navigation.breadcrumbs() %}
    <a href="{{ crumb.url }}">{{ crumb.title }}</a>
{% endfor %}

The crumb variable returned from the breadcrumbs() function will be an array with the following options. This will either contain information on a matched element, or information derived from the segment.

Properties#

PropertyDescription
titleThe title of the segment. Either the element's title, or derived from the segment.
urlThe absolute URL for the segment, for the current site.
segmentThe segment portion of the current URL.
isElementWhether the segment is an element or not.
elementIdThe ID of the element (if an element).

You can also pass in options to the breadcrumbs() function. For example, you could limit the number of breadcrumb items returned.

{% for crumb in craft.navigation.breadcrumbs({ limit: 10 }) %}
    <a href="{{ crumb.url }}">{{ crumb.title }}</a>
{% endfor %}

Available Options#

OptionsDescription
limitThe number to limit returned breadcrumbs item by.

Previous ← Navee Migration Next Navigation Field →

Get started with Navigation

Available for Craft 4. Get it from the plugin store.