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 { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
||||||
import { devUser } from '../credentials.js'
|
import { devUser } from '../credentials.js'
|
||||||
import { Media } from './collections/Media.js'
|
import { Media } from './collections/Media.js'
|
||||||
@@ -8,11 +8,6 @@ import { seed } from './seed/index.js'
|
|||||||
|
|
||||||
export default buildConfigWithDefaults({
|
export default buildConfigWithDefaults({
|
||||||
collections: [Users, Pages, Media],
|
collections: [Users, Pages, Media],
|
||||||
localization: {
|
|
||||||
defaultLocale: 'en',
|
|
||||||
fallback: true,
|
|
||||||
locales: ['en', 'es', 'de'],
|
|
||||||
},
|
|
||||||
i18n: {
|
i18n: {
|
||||||
translations: {
|
translations: {
|
||||||
es: {
|
es: {
|
||||||
@@ -22,35 +17,11 @@ export default buildConfigWithDefaults({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
localization: {
|
||||||
seoPlugin({
|
defaultLocale: 'en',
|
||||||
collections: ['users'],
|
fallback: true,
|
||||||
fields: [],
|
locales: ['en', 'es', 'de'],
|
||||||
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 || ''}`,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
onInit: async (payload) => {
|
onInit: async (payload) => {
|
||||||
await payload.create({
|
await payload.create({
|
||||||
collection: 'users',
|
collection: 'users',
|
||||||
@@ -62,4 +33,33 @@ export default buildConfigWithDefaults({
|
|||||||
|
|
||||||
await seed(payload)
|
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