You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to get to grips with the navigation plugin. i have successfully set it up according to here using {{ collections.all | eleventyNavigation | eleventyNavigationToHtml | safe }} {{ content | safe }}
However, the page also states that:
you can also pass any collection into eleventyNavigation. It doesn’t have to be collections.all!
I want a page to display a navigation menu only showing the pages i have tagged with mytag. But when I try {{ collections.mytag | eleventyNavigation | eleventyNavigationToHtml | safe }} {{ content | safe }}
the navigation disappears from my page instead of showing me a navigation menu for pages in the mytag collection. There is nothing where the navigation should be.
I have several pages with the following line in the front matter: tags: mytag
When i iterate over the mytag collection, i can see that the pages are correctly added. So the problem must be with how i call the navigation plugin. Am I missing a step?
Any suggestions much appreciated.
The text was updated successfully, but these errors were encountered:
@cybergrrl not sure what your template code and post code looks like so I'm shooting in the dark here. but I managed to get it working by making sure to change the for loop to have the name of the collection and being sure to include the eleventyNavigation and Key included in the front matter of your posts in that collection.
Encountering this same issue right now. eleventyNavigation works great as long as I pass in collections.all, but trying any other populated collection results in an empty Array output from eleventyNavigation.
{{ collections.all | eleventyNavigation }} # works as expected
{{ collections.nav-main | log }} # prints one element to the console/page
{{ collections.nav-main | eleventyNavigation | log }} # prints empty Array to the console and nothing on the page
I am trying to get to grips with the navigation plugin. i have successfully set it up according to here using
{{ collections.all | eleventyNavigation | eleventyNavigationToHtml | safe }} {{ content | safe }}
However, the page also states that:
I want a page to display a navigation menu only showing the pages i have tagged with mytag. But when I try
{{ collections.mytag | eleventyNavigation | eleventyNavigationToHtml | safe }} {{ content | safe }}
the navigation disappears from my page instead of showing me a navigation menu for pages in the mytag collection. There is nothing where the navigation should be.
I have several pages with the following line in the front matter:
tags: mytag
When i iterate over the mytag collection, i can see that the pages are correctly added. So the problem must be with how i call the navigation plugin. Am I missing a step?
Any suggestions much appreciated.
The text was updated successfully, but these errors were encountered: