Open alexroper opened 9 years ago
Hi Alex,
This idea might help you to get started:
<ul class="crumbs">
{% for node in craft.menus.getNodes('mainMenu') if node.active %}
{% if node.level == 1 %}
<li>{{ node.title }}</li>
{% elseif node.level == 2 %}
<li><a href="{{ node.parent.url }}">{{ node.parent }}</a></li>
<li>{{ node.title }}</li>
{% endif %}
{% endfor %}
</ul>
Hey @alexroper curious if @creativeorange's solution worked for you?
I did not end up using this solution because I needed a more flexible way to create breadcrumbs for content that's not included in the menu structure itself. I used a variation of this method from the Craft docs for Outputting a Custom List of Entries and creating an Entries field called "Breadcrumbs."
I'm trying to figure out if there's a way to create a breadcrumb navigation form a menu. I'd like to be able to search a menu's node for the current entry, and then get it's ancestors. Something like this:
Similar to how you can output breadcrumbs based on a Structure: http://buildwithcraft.com/help/breadcrumbs