eleventy-navigation icon indicating copy to clipboard operation
eleventy-navigation copied to clipboard

Current page in breadcrumb without link?

Open illycz opened this issue 1 year ago • 1 comments

illycz avatar Dec 17 '22 22:12 illycz

Hi illycz,

I had a similar spec. I created a breadcrumb component and include this is my templates. I then used an Nunjucks 'If Expression' to check if it was on the last (current) page and just render the title for that.

{% set crumbs = collections.all | eleventyNavigationBreadcrumb(eleventyNavigation.key, { includeSelf: true }) %}

{% for crumb in crumbs %}
	{% if page.url === crumb.url %} 
		{{ crumb.title }}
	{%- else -%}
    	        <a class="crumb" href="{{ crumb.url | url }}">{{ crumb.title }}</a> »
  	{%- endif -%}
{% endfor %}

(Due Credit: I got the base of my code from Mark Volkmann )

edharkins avatar Mar 11 '24 20:03 edharkins