Breadcrumb

A mini macro for a breadcrumb:

# usage
{{ macros::breadcrumb(path=page.components | safe) }}

# definition
{% macro breadcrumb(path) %}
{% set cur = "/" %} /
{% for elt in path %}
    {% set_global cur = cur ~ elt ~ "/" %}
    <a href="{{cur}}">{{ elt }}</a> /
{% endfor %}
{%- endmacro %}

Leading to this result:

image

1 Like