Replies: 1 comment
-
What was your solution? I managed to get it working w/ a global JSON file and didn't need a custom collection. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm converting a Jekyll blog to E11y, but I have the following collection (one file collection):
src/_data/navigation.yml:
items:I
link: /
subitems:
link: /#quemsou
link: /#CV
link: /#areas-de-conhecimento
link: /portfolio
link: /fale-comigo
link: /blog
src/_includes/navigation.html:
{% assign navurl = url | remove: 'index.html' %}
{% for item in collections.navigation %} {{ item.fileSlug }} {% if item.data.subitems %} {% include "navigation.html", navigation: "item.data.subitems" %} {% endif %} {% endfor %}
I'm getting the error: Cannot read property 'split' of undefined, file:/home/breguez/Dev/matbrgz.com/src/_includes/navigation.html, line:1My .eleventy.js:
const pkg = require("./package.json").eleventyConfig;
[...]
eleventyConfig.addCollection("navigation", function (collectionApi) {
return collectionApi.getFilteredByGlob("_data/navigation.yml");
});
return {
dir: pkg.dir
};
package.json
[...]
"eleventyConfig": {
"dir": {
"input": "src",
"output": "dist",
"includes": "_includes",
"layouts": "_layouts",
"data": "globals"
}
},
[...]
How to retrieve content from one Yaml file?
Beta Was this translation helpful? Give feedback.
All reactions