Breadcrumbs

Problem

You want to easily add automatic breadcrumbs to your website.

Solution

{% set crumbs = entry.ancestors|default([]) %}
{% if crumbs|length %}
    <ul class="breadcrumbs">
        <li><a href="{{ siteUrl }}">Home</a></li>
        {% for crumb in crumbs %}
            <li><a href="{{ crumb.url }}">{{ crumb.title }}</a></li>
        {% endfor %}
    </ul>
{% endif %}

This will show a list of breadcrumbs (if there are any to show). This is bare markup, it is assumed that you will use CSS for styling and separators.