test(plugin-seo): proper import and lint
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import seoPlugin from '../../packages/plugin-seo/src/index.js'
|
||||
import { seo } from '../../packages/plugin-seo/src/index.js'
|
||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
||||
import { devUser } from '../credentials.js'
|
||||
import { Media } from './collections/Media.js'
|
||||
@@ -8,11 +8,6 @@ import { seed } from './seed/index.js'
|
||||
|
||||
export default buildConfigWithDefaults({
|
||||
collections: [Users, Pages, Media],
|
||||
localization: {
|
||||
defaultLocale: 'en',
|
||||
fallback: true,
|
||||
locales: ['en', 'es', 'de'],
|
||||
},
|
||||
i18n: {
|
||||
translations: {
|
||||
es: {
|
||||
@@ -22,35 +17,11 @@ export default buildConfigWithDefaults({
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
seoPlugin({
|
||||
collections: ['users'],
|
||||
fields: [],
|
||||
tabbedUI: true,
|
||||
}),
|
||||
seoPlugin({
|
||||
collections: ['pages', 'posts'],
|
||||
globals: ['settings'],
|
||||
tabbedUI: true,
|
||||
uploadsCollection: 'media',
|
||||
fields: [
|
||||
{
|
||||
name: 'ogTitle',
|
||||
type: 'text',
|
||||
label: 'og:title',
|
||||
},
|
||||
],
|
||||
fieldOverrides: {
|
||||
title: {
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
generateTitle: (data: any) => `Website.com — ${data?.doc?.title?.value}`,
|
||||
generateDescription: ({ doc }: any) => doc?.excerpt?.value || 'generated description',
|
||||
generateURL: ({ doc, locale }: any) =>
|
||||
`https://yoursite.com/${locale ? locale + '/' : ''}${doc?.slug?.value || ''}`,
|
||||
}),
|
||||
],
|
||||
localization: {
|
||||
defaultLocale: 'en',
|
||||
fallback: true,
|
||||
locales: ['en', 'es', 'de'],
|
||||
},
|
||||
onInit: async (payload) => {
|
||||
await payload.create({
|
||||
collection: 'users',
|
||||
@@ -62,4 +33,33 @@ export default buildConfigWithDefaults({
|
||||
|
||||
await seed(payload)
|
||||
},
|
||||
plugins: [
|
||||
seo({
|
||||
collections: ['users'],
|
||||
fields: [],
|
||||
tabbedUI: true,
|
||||
}),
|
||||
seo({
|
||||
collections: ['pages', 'posts'],
|
||||
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 || ''}`,
|
||||
globals: ['settings'],
|
||||
tabbedUI: true,
|
||||
uploadsCollection: 'media',
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user