Thinkmill / Thinkmill/keystatic
Give more freedom to customise the preview url
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 159
- Avg merge
- 21h 41m
- Merged PRs (30d)
- 2
Description
Hello Keystatic team!
I'm using Keystatic with Astro for building a news website.
I feel it's very boring to copy / paste the slug of my article to view the result.
I can't use previewUrl stuff that @emmatown built because the final url of my blog post are depending on a field value of the entry (here is the category: news, bourse, bank...).
Could it be more friendly to have a function for previewUrl with the {value} as props and we return the pathname of the final url of the entry ?
Something like this :
posts: collection({
label: "Posts",
slugField: "title",
path: "src/content/posts/**",
entryLayout: "content",
previewUrl: ({value}) => `/${entry.category}/${entry.slug}`,
schema: {
...
category: fields.select({
label: "Category",
options: categorySelectOptions,
defaultValue: categorySelectOptions[0].value,
}),
...
Thank you and have a good day
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 reading the existing previewUrl support for collections and the collection configuration shown in the issue. Determine how a preview callback could receive the entry value and return a pathname based on fields such as category and slug; done means a collection can configure that callback and generate the requested final URL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- content, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100