eleventy
eleventy copied to clipboard
Permalink issue with collection.js but not collection.json?
Operating system
Windows 11
Eleventy
2.0.1
Describe the bug
Repo: https://github.com/wcDogg/eleventy-test
Structure:
- There are 2 source collections -
.src/content/blog
and.src/content/docs
. -
blog
has ablog.js
. -
docs
has adocs.json
. - In both, the permalinks is like:
"/docs/{{ page.fileSlug }}/"
.
When I run the build:
- The
docs.json
collection outputs as expected. - The
blog.js
collection outputs nested insidecontent
.
I can't imagine why, but do have to format permalinks differently when using JS vs JSON?
Reproduction steps
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See an error
Expected behavior
No response
Reproduction URL
No response
Screenshots
No response
Hi @wcDogg, it seems like you created another commit on your main, so the repo no longer shows your issue with the JS file.
Putting that aside, I created a PR in https://github.com/wcDogg/eleventy-test/pull/1 of how I'd restructure that repo to work more like 11ty expects projects to work (so you don't need to hack around collections and have your custom plugins outside of the src folder, which should only files that 11ty uses during a build and not for configuring the build. I also removed the calls to addWatchTarget
as 11ty does this automatically when adding a passthrough copy.
One final note: The issue templates make it significantly faster and therefore easier for others to help you. Filling them out as complete and correct as possible helps other to help you.