11ty/eleventy-navigation

eleventyNavigationBreadcrumb option includeSelf broken with Liquid

alangibson opened this issue · 0 comments

It seems that the includeSelf option for the eleventyNavigationBreadcrumb filter doesn't work with Liquid templates. This does not include the current page in the breadcrumb trail:

    {{ collections.all | eleventyNavigationBreadcrumb: eleventyNavigation.key, includeSelf: true | eleventyNavigationToHtml }}

The problem is here:

function findBreadcrumbEntries(nodes, activeKey, options = {}) {
    ...
	if(options.includeSelf) {
		deps.push(activeKey);
	}

When using Liquid templates, options is actually an array [ 'includeSelf', true ]

Substituting the if statement with the following fixes it:

    if(options.includeSelf || ( Array.isArray(options) && options[options.indexOf('includeSelf')])) {

Versions:

    "@11ty/eleventy": "^1.0.0-beta.8",
    "@11ty/eleventy-navigation": "^0.3.2",