Thinkmill / Thinkmill/keystatic
Enhancement: more configurable collection path
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 159
- Avg merge
- 21h 41m
- Merged PRs (30d)
- 2
Description
Current state
Currently, the path is always static except for the slug, specified by slugField.
The problem
Projects often require more custom paths, e.g.: locales, publish date
Proposal
Make the collection config an intersection like so (pseudocode):
type Collection = { /* base props */}
& (
{
path: string // with * validation
slugField: keyof fields
}
| {
path: (fields: Record<string, any>) => string // with * validation
slugField: keyof fields // might not be required, we could manually specify the field by interpolation instead
}
)
Examples
Locales
export default defineConfig({
// ...
collections: {
blog: collection({
label: "Blog",
path: ({ locale }) => `src/content/blog/${locale}/*`
schema: {
// ...
locale: fields.text({ label: "Locale" }) // could be a relationship, whatever
}
})
}
})
Publish date
export default defineConfig({
// ...
collections: {
blog: collection({
label: "Blog",
path: ({ publishDate }) => `src/content/blog/${publishDate}.*`
schema: {
// ...
publishDate: fields.date({ label: "Published date" })
}
})
}
})
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the TypeScript definitions and implementation behind defineConfig and collection, focusing on the current static path and slugField behavior. Review how schema fields are exposed to path configuration and how wildcard validation works; done means supporting the proposed field-based path forms with clear typing and validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design, content
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100