Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give more freedom to customise the preview url #1024

Open
emilienbidet opened this issue Mar 17, 2024 · 0 comments
Open

Give more freedom to customise the preview url #1024

emilienbidet opened this issue Mar 17, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@emilienbidet
Copy link
Contributor

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

@jossmac jossmac added the enhancement New feature or request label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants