fix(preset-eleventy): write posts where the advertised URL resolves - #916
Draft
rmdes wants to merge 1 commit into
Draft
fix(preset-eleventy): write posts where the advertised URL resolves#916rmdes wants to merge 1 commit into
rmdes wants to merge 1 commit into
Conversation
`getPostTypes` put the date in the filename but advertised it as path
segments:
path: `${collection}/{yyyy}-{MM}-{dd}-{slug}.md`
url: `${collection}/{yyyy}/{MM}/{dd}/{slug}`
Eleventy derives a page's URL from its input path and makes no such
translation, so the URL returned in the `Location` header and shown as
"Post will be created at …" does not resolve. The file is written
correctly and the request succeeds, so nothing surfaces it.
Write the date as directories instead, so the path Eleventy serves is
the URL Indiekit reported. The `url` template is unchanged, so the URL
scheme itself does not move.
Verified against Eleventy 3: `content/notes/2026/08/22/hello.md` builds
to `_site/notes/2026/08/22/hello/index.html`.
Refs #902
rmdes
marked this pull request as draft
August 24, 2026 16:52
paulrobertlloyd
force-pushed
the
main
branch
2 times, most recently
from
August 27, 2026 20:07
67b3847 to
fa1d368
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes half of #902 — the Eleventy half, which is fully solvable inside the preset.
The problem
getPostTypesputs the date in the filename and advertises it as path segments:Eleventy derives a page's URL from its input path and makes no such translation, so the URL returned in the
Locationheader — and shown in the interface as "Post will be created at …" — doesn't resolve. The file is written correctly and the request succeeds, so nothing surfaces the problem. If syndication is enabled, the dead URL has already gone out.The change
One line: write the date as directories.
The
urltemplate is untouched, so the advertised URL scheme doesn't move — this only makes the file land where that URL already pointed.Verification
Eleventy 3, stock config,
dir.input = content:which is exactly
notes/{yyyy}/{MM}/{dd}/{slug}.Test suite:
10 pass, 0 fail.eslintandprettier --checkclean on the changed files.On the test
The three existing expectations asserted the old path, so they move with the change. I've also added one that asserts the property the issue is about, rather than the literal strings:
Nothing currently tests that
pathandurlagree, which is why this was invisible. On the unfixed code it fails with:Worth knowing
preset-jekyllneeds a different fix (front-matterpermalink) and is left for a separate PR;preset-hugois unaffected.