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.
elementThe element object (if an element).
elementIdThe ID of the element (if an element).
elementTypeThe type of 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 ← Rendering Nodes Next Navigation Field →