Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eleventyNavigationBreadcrumb option includeSelf broken with Liquid #35

Open
alangibson opened this issue Dec 22, 2021 · 0 comments
Open

Comments

@alangibson
Copy link

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",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant