Closed einomi closed 3 years ago
I think your code and logic is correct, but per https://www.11ty.dev/docs/config/#directory-for-global-data-files, the _data/
directory should be within your src/
directory.
# Build site, should fail to resolve `data1.items` object and exit w/ errorcode.
npm run build:eleventy
> frontenso-11ty-starter@1.0.0 build:eleventy /private/tmp/500k-pages-with-11ty
> eleventy
Problem writing Eleventy templates: (more in DEBUG output)
> Could not resolve pagination key in template data: data1.items
# ...
# Move ./_data/ directory into the ./src/ directory...
mv _data src
## Rebuild site...
npm run build:eleventy
> frontenso-11ty-starter@1.0.0 build:eleventy /private/tmp/500k-pages-with-11ty
> eleventy
Writing dist/repudiandae-voluptas-quisquam/index.html from ./src/pages.njk.
Writing dist/voluptatem-quidem-aperiam/index.html from ./src/pages.njk.
Writing dist/praesentium-dicta-fuga/index.html from ./src/pages.njk.
Writing dist/nostrum-magnam-porro/index.html from ./src/pages.njk.
Writing dist/voluptatum-eligendi-quasi/index.html from ./src/pages.njk.
Writing dist/harum-esse-ipsum/index.html from ./src/pages.njk.
Writing dist/cupiditate-placeat-nemo/index.html from ./src/pages.njk.
Writing dist/nobis-maxime-similique/index.html from ./src/pages.njk.
Writing dist/aspernatur-accusamus-aut/index.html from ./src/pages.njk.
Writing dist/nulla-quibusdam-perspiciatis/index.html from ./src/pages.njk.
Copied 1 file / Wrote 10 files in 0.13 seconds (13.0ms each, v0.12.1)
Oh, thanks @pdehaan! It works now.
By the way, I didn't know how to add a custom error handler to 11ty so I ended up with spawning a process with a custom script https://github.com/frontenso/500k-pages-with-11ty/blob/master/scripts/eleventy-dev.js but I will probably create a new issue on this
Describe the bug I'm trying to generate pages from _data/data1.json file using the pagination feature but get
Could not resolve pagination key in template data
error during the build. This is the example repo https://github.com/frontenso/500k-pages-with-11ty What do I do wrong?To Reproduce Steps to reproduce the behavior:
npm run start
Additional Information pages.njk contents: