Home / Function/ generatePreviewPath() — supabase Function Reference

generatePreviewPath() — supabase Function Reference

Architecture documentation for the generatePreviewPath() function in generatePreviewPath.ts from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/cms/src/utilities/generatePreviewPath.ts lines 15–32

export const generatePreviewPath = ({ collection, slug }: Props) => {
  if (collection === 'posts') {
    const baseUrl = WWW_SITE_ORIGIN || 'http://localhost:3000'
    // Use our preview API route for post previews
    return `${baseUrl}/api-v2/cms/preview?slug=${slug}`
  }

  const encodedParams = new URLSearchParams({
    slug,
    collection,
    path: `${collectionPrefixMap[collection]}/${slug}`,
    previewSecret: process.env.PREVIEW_SECRET || '',
  })

  const url = `/next/preview?${encodedParams.toString()}`

  return url
}

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free