BREAKING CHANGE: All plugins have been updated to use named exports and the names have been updated to be consistent.
// before
import { cloudStorage } from '@payloadcms/plugin-cloud-storage'
// current
import { cloudStoragePlugin } from '@payloadcms/plugin-cloud-storage'
//before
import { payloadCloud } from '@payloadcms/plugin-cloud'
// current
import { payloadCloudPlugin } from '@payloadcms/plugin-cloud'
//before
import formBuilder from '@payloadcms/plugin-form-builder'
// current
import { formBuilderPlugin } from '@payloadcms/plugin-form-builder'
//before
import { nestedDocs } from '@payloadcms/plugin-nested-docs'
// current
import { nestedDocsPlugin } from '@payloadcms/plugin-nested-docs'
//before
import { redirects } from '@payloadcms/plugin-redirects'
// current
import { redirectsPlugin } from '@payloadcms/plugin-redirects'
// before
import search from '@payloadcms/plugin-search'
// current
import { searchPlugin } from '@payloadcms/plugin-search'
//before
import { sentry } from '@payloadcms/plugin-sentry'
// current
import { sentryPlugin } from '@payloadcms/plugin-sentry'
// before
import { seo } from '@payloadcms/plugin-seo'
// current
import { seoPlugin } from '@payloadcms/plugin-seo'
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import { searchPlugin } from '@payloadcms/plugin-search'
|
|
|
|
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
|
import { devUser } from '../credentials.js'
|
|
import { Pages } from './collections/Pages.js'
|
|
import { Posts } from './collections/Posts.js'
|
|
import { Users } from './collections/Users.js'
|
|
import { seed } from './seed/index.js'
|
|
|
|
export default buildConfigWithDefaults({
|
|
collections: [Users, Pages, Posts],
|
|
localization: {
|
|
defaultLocale: 'en',
|
|
fallback: true,
|
|
locales: ['en', 'es', 'de'],
|
|
},
|
|
onInit: async (payload) => {
|
|
await payload.create({
|
|
collection: 'users',
|
|
data: {
|
|
email: devUser.email,
|
|
password: devUser.password,
|
|
},
|
|
})
|
|
|
|
await seed(payload)
|
|
},
|
|
plugins: [
|
|
searchPlugin({
|
|
beforeSync: ({ originalDoc, searchDoc }) => ({
|
|
...searchDoc,
|
|
excerpt: originalDoc?.excerpt || 'This is a fallback excerpt',
|
|
}),
|
|
collections: ['pages', 'posts'],
|
|
defaultPriorities: {
|
|
pages: 10,
|
|
posts: ({ title }) => (title === 'Hello, world!' ? 30 : 20),
|
|
},
|
|
searchOverrides: {
|
|
fields: [
|
|
{
|
|
name: 'excerpt',
|
|
type: 'text',
|
|
admin: {
|
|
readOnly: true,
|
|
},
|
|
label: 'Excerpt',
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
],
|
|
})
|