eleventy icon indicating copy to clipboard operation
eleventy copied to clipboard

Permalink issue with collection.js but not collection.json?

Open wcDogg opened this issue 1 year ago • 1 comments

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 a blog.js.
  • docs has a docs.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 inside content.

I can't imagine why, but do have to format permalinks differently when using JS vs JSON?

Reproduction steps

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See an error

Expected behavior

No response

Reproduction URL

No response

Screenshots

No response

wcDogg avatar Nov 28 '23 17:11 wcDogg

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.

Snapstromegon avatar Nov 28 '23 22:11 Snapstromegon