Skip to content
Discussion options

You must be logged in to vote

In your above code, if (doc?.slug) makes the preview button only show if there's a slug.

You can write another condition or remove the condition and just return the preview URL.

As an example:

export const Plans: CollectionConfig = {
  slug: 'plans',
  admin: {
    useAsTitle: 'title',
    preview: (doc, { locale }) => {
        // Always return the same preview URL for the plans collection in each locale
        return `https://bigbird.com/preview/plans?locale=${locale}`;
    },
  },
  access: DEFAULT_ACCESS_CONTROL,
  fields: [
    {
      name: 'title',
      label: 'Title',
      type: 'text',
      localized: true,
    },
    {
      name: 'id',
      label: 'Custom ID',
      type: '…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by zubricks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants