Implement live preview
This commit is contained in:
@ -28,6 +28,7 @@ import Authors from '@payload/collections/Authors'
|
||||
import Posts from '@payload/collections/Posts'
|
||||
import Users from '@payload/collections/Users'
|
||||
import Pages from '@payload/collections/Pages'
|
||||
import { COLLECTION_SLUG_PAGE, COLLECTION_SLUG_POST } from '@/app/(payload)/collections/config'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
@ -40,6 +41,12 @@ export default buildConfig({
|
||||
password: 'test',
|
||||
prefillOnly: true,
|
||||
},
|
||||
livePreview: {
|
||||
url: ({ data, locale }) =>
|
||||
//TODO: Rewrite to collection_slug/preview/
|
||||
`${process.env.BASE_URL}/preview${data.path}${locale ? `?locale=${locale.code}` : ''}`,
|
||||
collections: [COLLECTION_SLUG_PAGE],
|
||||
},
|
||||
},
|
||||
editor: lexicalEditor(),
|
||||
secret: process.env.PAYLOAD_SECRET || '',
|
||||
|
Reference in New Issue
Block a user