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'
67 lines
1.7 KiB
TypeScript
67 lines
1.7 KiB
TypeScript
import { seoPlugin } from '@payloadcms/plugin-seo'
|
|
import { en } from '@payloadcms/translations/languages/en'
|
|
import { es } from '@payloadcms/translations/languages/es'
|
|
|
|
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
|
import { devUser } from '../credentials.js'
|
|
import { Media } from './collections/Media.js'
|
|
import { Pages } from './collections/Pages.js'
|
|
import { Users } from './collections/Users.js'
|
|
import { seed } from './seed/index.js'
|
|
|
|
export default buildConfigWithDefaults({
|
|
collections: [Users, Pages, Media],
|
|
i18n: {
|
|
supportedLanguages: {
|
|
en,
|
|
es,
|
|
},
|
|
translations: {
|
|
es: {
|
|
'plugin-seo': {
|
|
autoGenerate: 'Auto-génerar',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
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: [
|
|
seoPlugin({
|
|
collections: ['pages'],
|
|
fieldOverrides: {
|
|
title: {
|
|
required: true,
|
|
},
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'ogTitle',
|
|
type: 'text',
|
|
label: 'og:title',
|
|
},
|
|
],
|
|
generateDescription: ({ doc }: any) => doc?.excerpt?.value || 'generated description',
|
|
generateTitle: (data: any) => `Website.com — ${data?.doc?.title?.value}`,
|
|
generateURL: ({ doc, locale }: any) =>
|
|
`https://yoursite.com/${locale ? locale + '/' : ''}${doc?.slug?.value || ''}`,
|
|
tabbedUI: true,
|
|
uploadsCollection: 'media',
|
|
}),
|
|
],
|
|
})
|