am-impact / amnav

Navigation plugin for Craft
168 stars 19 forks source link

Is there a method for getting ancestors of an entry? #2

Closed m-collins closed 9 years ago

m-collins commented 10 years ago

On crafts documentation, they recommend this method for outputting a breadcrumbs for a structure.

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

I'd like to use amnav for the flexibility of not having to work within a structure. However, I need to be able to produce breadcrumbs from the navigation.

hubertprein commented 10 years ago

Creating breadcrumbs based on a created navigation isn't going to work. E.g.: if you would navigate to a channel type entry, and you didn't include this in your navigation, your breadcrumbs will fail.

I've been working on an update, that'll also include a breadcrumb tag. This tag functionality isn't based on a created navigation, but should work for every page you navigate too (unless you added routes). I will release this update shortly.

hubertprein commented 10 years ago

Please check out the new release and let me know if this works out for you.