payloadcms / payload

The best way to build a modern backend + admin UI. No black magic, all TypeScript, and fully open-source, Payload is both an app framework and a headless CMS.
https://payloadcms.com
MIT License
21.1k stars 1.27k forks source link

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

Closed paulpopus closed 1 day ago

paulpopus commented 2 days ago

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

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',
})
jacobsfletch commented 2 days ago

IMO these exports need to be appended with Field, i.e. MetaImageField

jacobsfletch commented 2 days ago

We also need docs for this and all other plugin changes, i.e. the new function overrides pattern. Those are under the /docs/plugins/seo directory.