11import type { Config } from 'payload/config'
22import type { Field , GroupField , TabsField } from 'payload/dist/fields/config/types'
33
4+ import { deepMerge } from 'payload/utilities'
5+
46import type { PluginConfig } from './types'
57
68import { getMetaDescriptionField } from './fields/MetaDescription'
79import { getMetaImageField } from './fields/MetaImage'
810import { getMetaTitleField } from './fields/MetaTitle'
11+ import translations from './translations'
912import { Overview } from './ui/Overview'
1013import { getPreviewField } from './ui/Preview'
11- import { deepMerge } from 'payload/dist/utilities/deepMerge'
12- import translations from './translations'
1314
1415const seo =
1516 ( pluginConfig : PluginConfig ) =>
1617 ( config : Config ) : Config => {
1718 const seoFields : GroupField [ ] = [
1819 {
1920 name : 'meta' ,
21+ type : 'group' ,
2022 fields : [
2123 {
2224 name : 'overview' ,
25+ type : 'ui' ,
2326 admin : {
2427 components : {
2528 Field : Overview ,
2629 } ,
2730 } ,
2831 label : 'Overview' ,
29- type : 'ui' ,
3032 } ,
3133 {
3234 name : 'title' ,
35+ type : 'text' ,
3336 admin : {
3437 components : {
3538 Field : ( props ) => getMetaTitleField ( { ...props , pluginConfig } ) ,
3639 } ,
3740 } ,
3841 localized : true ,
39- type : 'text' ,
4042 } ,
4143 {
4244 name : 'description' ,
45+ type : 'textarea' ,
4346 admin : {
4447 components : {
4548 Field : ( props ) => getMetaDescriptionField ( { ...props , pluginConfig } ) ,
4649 } ,
4750 } ,
4851 localized : true ,
49- type : 'textarea' ,
5052 } ,
5153 ...( pluginConfig ?. uploadsCollection
5254 ? [
5355 // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
5456 {
5557 name : 'image' ,
58+ type : 'upload' ,
5659 admin : {
5760 components : {
5861 Field : ( props ) => getMetaImageField ( { ...props , pluginConfig } ) ,
@@ -63,24 +66,22 @@ const seo =
6366 label : 'Meta Image' ,
6467 localized : true ,
6568 relationTo : pluginConfig ?. uploadsCollection ,
66- type : 'upload' ,
6769 } as Field ,
6870 ]
6971 : [ ] ) ,
7072 ...( pluginConfig ?. fields || [ ] ) ,
7173 {
7274 name : 'preview' ,
75+ type : 'ui' ,
7376 admin : {
7477 components : {
7578 Field : ( props ) => getPreviewField ( { ...props , pluginConfig } ) ,
7679 } ,
7780 } ,
7881 label : 'Preview' ,
79- type : 'ui' ,
8082 } ,
8183 ] ,
8284 label : 'SEO' ,
83- type : 'group' ,
8485 } ,
8586 ]
8687
@@ -95,6 +96,7 @@ const seo =
9596 if ( pluginConfig ?. tabbedUI ) {
9697 const seoTabs : TabsField [ ] = [
9798 {
99+ type : 'tabs' ,
98100 tabs : [
99101 // append a new tab onto the end of the tabs array, if there is one at the first index
100102 // if needed, create a new `Content` tab in the first index for this collection's base fields
@@ -111,7 +113,6 @@ const seo =
111113 label : 'SEO' ,
112114 } ,
113115 ] ,
114- type : 'tabs' ,
115116 } ,
116117 ]
117118
@@ -141,6 +142,7 @@ const seo =
141142 if ( pluginConfig ?. tabbedUI ) {
142143 const seoTabs : TabsField [ ] = [
143144 {
145+ type : 'tabs' ,
144146 tabs : [
145147 // append a new tab onto the end of the tabs array, if there is one at the first index
146148 // if needed, create a new `Content` tab in the first index for this global's base fields
@@ -157,7 +159,6 @@ const seo =
157159 label : 'SEO' ,
158160 } ,
159161 ] ,
160- type : 'tabs' ,
161162 } ,
162163 ]
163164
0 commit comments