feat(plugin-seo): export fields from plugin seo so that they can be imported freely in a collection fields config (#6996)

Exports the fields from the SEO plugin so that they can be used anywhere
inside a collection, new exports:

```ts
import { MetaDescriptionField, MetaImageField, MetaTitleField, OverviewField, PreviewField } from '@payloadcms/plugin-seo/fields'

// Used as fields
MetaImageField({
  relationTo: 'media',
  hasGenerateFn: true,
})

MetaDescriptionField({
  hasGenerateFn: true,
})

MetaTitleField({
  hasGenerateFn: true,
})

PreviewField({
  hasGenerateFn: true,
  titlePath: 'meta.title',
  descriptionPath: 'meta.description',
})

OverviewField({
  titlePath: 'meta.title',
  descriptionPath: 'meta.description',
  imagePath: 'meta.image',
})

```
This commit is contained in:
Paul
2024-07-02 09:53:52 -04:00
committed by GitHub
parent 0711f880ff
commit 25d368a7db
18 changed files with 492 additions and 48 deletions

View File

@@ -13,6 +13,7 @@ import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
import { devUser } from '../credentials.js'
import { Media } from './collections/Media.js'
import { Pages } from './collections/Pages.js'
import { PagesWithImportedFields } from './collections/PagesWithImportedFields.js'
import { Users } from './collections/Users.js'
import { seed } from './seed/index.js'
@@ -29,7 +30,7 @@ const generateURL: GenerateURL<Page> = ({ doc, locale }) => {
}
export default buildConfigWithDefaults({
collections: [Users, Pages, Media],
collections: [Users, Pages, Media, PagesWithImportedFields],
i18n: {
supportedLanguages: {
en,