TypeError: Cannot read property 'inputPath' of undefined (via Template render error) #2688
-
|
Hi, 11ty newbie here and I've ran into an issue where I assume the fix is obvious but I've been trying different things for a while now and nothing seems to get it to work. I've been broadly following this tutorial and I'm trying layout chaining using the blog post pagination example. It did originally work when I initially tried it but, since I made some other config updates, I started getting the following error: I'm stumped why it's not picking up the _'blogPagination.njk' file because the filepath it's referencing seems correct. This is the directory structure: This is the 'eleventy.js': This is the _'blogPagination.njk': And this is the _'blogPosts.njk': I've tried different variations for the filepath reference, like "/partials/_blogPagination.njk" and "./partials/_blogPagination.njk" and "../_includes/partials/_blogPagination.njk", but I thought what's currently included in the file should be correct as it's showing the correct path in the error. Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
|
Does this work? ( - {% set previousBlogPost = collections.blogPost | getPreviousCollectionItem(blogPost) %}
- {% set nextBlogPost = collections.blogPost | getNextCollectionItem(blogPost) %}
+ {% set previousBlogPost = collections.blogPost | getPreviousCollectionItem(page) %}
+ {% set nextBlogPost = collections.blogPost | getNextCollectionItem(page) %} |
Beta Was this translation helpful? Give feedback.
-
|
Ah it does work - thank you! I'm new to the syntax so I'm not too sure why it works (think I need to read up on sets). Is 'page' a particular keyword or referencing something here? I thought it was similar to a parameter referencing each item in the 'blogPost' collections array, so could theoretically be called anything. Or was the issue that I had the name the same as the collection's name and it needed to be something different? (so 'blogPost' might work here if the collection was called 'blogPosts'?). |
Beta Was this translation helpful? Give feedback.
Does this work? (
blogPost=>page)