Navigation outputting all pages and missing key & title fields.
koitaki opened this issue · 3 comments
Couple of questions please:
- Does the navigation plugin return all pages by default, not just the ones to which I've added front matter?
- Do recent versions not return title and key?
Because that is what I'm currently getting in my output.
I'm using:
"@11ty/eleventy-navigation": "^0.3.2"
I have about 8 parent pages where I've put front matter for the plugin, using some variant of the following:
eleventyNavigation:
key: Blog
order: 6
And I try to access that on my navigation page with:
{%- for item in collections.all | eleventyNavigation -%}
code...
{% endfor %}
But I don't get any key or title in the output.
However, I do get other fields, such as url, plugin-type, and order.
I also get every page in the collection, not just the parents.
Eg. I try this dump:
{{ collections.all | eleventyNavigation | dump }}
And I get all pages, not just the 8 in which I've added the navigation front matter, as per this snapshot:
[
{"url":"/admin/","pluginType":"eleventy-navigation"},
{"url":"/audio-livres/audible/","pluginType":"eleventy-navigation"},
{"url":"/audio-livres/scribd/","pluginType":"eleventy-navigation"},
{"url":"/feuilletons/lapocalypse-est-notre-chance/","pluginType":"eleventy-navigation"},
{"url":"/feuilletons/lappel-des-abysses/","pluginType":"eleventy-navigation"},
{"url":"/feuilletons/les-aventures-de-harry-lime/","pluginType":"eleventy-navigation"},
:
etc
:
{"order":1,"url":"/","pluginType":"eleventy-navigation"},
{"order":2,"url":"/grammar/","pluginType":"eleventy-navigation"},
{"order":7,"url":"/about/","pluginType":"eleventy-navigation"},
{"order":8,"url":"/contact/","pluginType":"eleventy-navigation"}
]
Seems odd, and a bit different to what I was expecting.?
I'm also seeing this on 0.3.2
. I even tried filtering by passing in a key argument like in the docs:
{{ collections.all | eleventyNavigation: "Navbar" }}
But that still ended up returning other pages that don't have that key.
Howdy y’all, I will need a test case to reproduce this—the tests seem to be operating fine in both Nunjucks and Liquid. The eleventyNavigation
filter returns results that have an eleventyNavigation
prop.
Can you review the liquid and Nunjucks samples in the repo?
- https://github.com/11ty/eleventy-navigation/blob/32f3bdfe9e467a8e8e4aa4f43c89cdd9ba53314d/sample/nunjucks/index.njk
- https://github.com/11ty/eleventy-navigation/blob/32f3bdfe9e467a8e8e4aa4f43c89cdd9ba53314d/sample/liquid/index.liquid
Maybe run npm run sample
in the demo and check the output in sample/_site/
This is an automated message to let you know that a helpful response was posted to your issue and for the health of the repository issue tracker the issue will be closed. This is to help alleviate issues hanging open waiting for a response from the original poster.
If the response works to solve your problem—great! But if you’re still having problems, do not let the issue’s closing deter you if you have additional questions! Post another comment and we will reopen the issue. Thanks!