0

My Entry URL Format looks like this: {section}/{slug} and I am using the standard breadcrumbs code;

   {% if entry.level > 1 %}
    <ul class="crumbs">
        {% for crumb in entry.getAncestors() %}
            <li>{{ crumb.getLink() }}</li>
        {% endfor %}
    </ul>
{% endif %}

This will parse:

Home > article > entry-title

how can you add the {section} in as:

Home > section name > article > entry-title

1 Answer 1

1

I don't believe there's a more "magic" way than just hard coding the first list item/link, i.e. something like this:

{% if entry.level > 1 %}
    <ul class="crumbs">
        <li>
            <a href="/{{ entry.section.handle }}">{{ entry.section.name }}</a>
        </li>
        {% for crumb in entry.getAncestors() %}
            <li>{{ crumb.getLink() }}</li>
        {% endfor %}
    </ul>
{% endif %}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.