Breadcrumbs - MizzouCreative/mizzoumvc GitHub Wiki

Description

If breadcrumbs have been enabled (via either the theme setting include_breadcrumbs or enabled via a controller) the token Breadcrumbs will be available in your view. Breadcrumbs contains one public property crumbs which is an array of Crumb objects corresponding to the ancestors of the current item, ordered furthest to closest, including a Crumb object for the current item with an empty URL.

Each Crumb object contains the following properties:

  • URL - The the URL of the ancestor
  • name - The text identifying the ancestor

Example usage

{% if Breadcrumbs is defined and Breadcrumbs.crumbs | length > 0 %}
<div id="breadcrumb">
    <ul>
    {% for Crumb in Breadcrumbs.crumbs %}
        <li{% if loop.first %} class="bread-home"{% endif %}>
            {% if Crumb.URL is not empty %}
            <a href="{{ Crumb.URL }}">
            {% endif %}
            {{ Crumb.name }}
            {% if Crumb.URL is not empty %}
            </a>
            {% endif %}
        </li>
    {% endfor %}
    </ul>
</div>
{% endif %}

Additional Information

If the theme settings home_text and home_url are set, those will be used for the furthest ancestor. Otherwise, the defaults of "Home" and a relative link to root (/) are used. If the theme setting inject_post_home is set, then the settings inject_post_home_text and inject_post_home_url will be used to create an additional ancestor between "home" and the true ancestors.

⚠️ **GitHub.com Fallback** ⚠️