Repository navigation
Conversation
Allow path segments bound to schema fields: path: 'blog/{locale}/*'.
Placeholder fields are filled from serialized field values at entry
creation; editing moves the entry via slug-rename. Backwards compatible
— paths without { are unchanged. Multi-glob paths now error clearly.
Solves Thinkmill#340.
🦋 Changeset detectedLatest commit: 8561ca0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
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.
Solves #340 — more configurable collection paths (locales, publish dates, etc.).
Approach
Rather than bare
path: (fields) => stringcallbacks, this implements{field}placeholders as full path segments — matching the direction discussed on the issue (field names embedded in the path keep entry listing statically knowable for the GitHub storage backend):en/my-post) — same composite-slug model**collections already use, so routing, URLs, the reader, and both storage backends work unchanged{x}segments from each field's serialized value (serializeWithSlug/serialize, primitives coerced); static mid-pattern segments ({x}/posts/*) work too{behave exactly as before; multi-glob paths now produce a clear error instead of silent corruptionTests
path-utils.test.ts: 14 tests — parsing/errors, schema validation, slug composition, tree listing at exact depth, readerlist/readwith composite slugs, wrong-depth rejectionvitest run: 1265 pass;tscclean;build:packagesOKNotes
{x}values aren't slugified — segment-safety is enforced at save via field validationen/foo≠fr/foo) and save-time placeholder validation are covered@algora-pbc /claim #340