fix(plugin-seo): titles being displayed twice (#8310)
This commit is contained in:
@@ -100,7 +100,13 @@ export const MetaDescriptionComponent: React.FC<MetaDescriptionProps> = (props)
|
||||
}}
|
||||
>
|
||||
<div className="plugin-seo__field">
|
||||
<FieldLabel field={null} Label={Label} label={label} {...(labelProps || {})} />
|
||||
<FieldLabel
|
||||
field={null}
|
||||
Label={Label}
|
||||
label={label}
|
||||
required={required}
|
||||
{...(labelProps || {})}
|
||||
/>
|
||||
{hasGenerateDescriptionFn && (
|
||||
<React.Fragment>
|
||||
—
|
||||
@@ -151,7 +157,6 @@ export const MetaDescriptionComponent: React.FC<MetaDescriptionProps> = (props)
|
||||
Component: null,
|
||||
RenderedComponent: errorMessage,
|
||||
}}
|
||||
label={label}
|
||||
onChange={setValue}
|
||||
path={pathFromContext}
|
||||
required={required}
|
||||
|
||||
@@ -102,7 +102,13 @@ export const MetaImageComponent: React.FC<MetaImageProps> = (props) => {
|
||||
}}
|
||||
>
|
||||
<div className="plugin-seo__field">
|
||||
<FieldLabel field={null} Label={Label} label={label} {...(labelProps || {})} />
|
||||
<FieldLabel
|
||||
field={null}
|
||||
Label={Label}
|
||||
label={label}
|
||||
required={required}
|
||||
{...(labelProps || {})}
|
||||
/>
|
||||
{hasGenerateImageFn && (
|
||||
<React.Fragment>
|
||||
—
|
||||
@@ -151,7 +157,6 @@ export const MetaImageComponent: React.FC<MetaImageProps> = (props) => {
|
||||
RenderedComponent: errorMessage,
|
||||
}}
|
||||
filterOptions={field.filterOptions}
|
||||
label={undefined}
|
||||
onChange={(incomingImage) => {
|
||||
if (incomingImage !== null) {
|
||||
if (typeof incomingImage === 'object') {
|
||||
|
||||
@@ -37,11 +37,11 @@ export const MetaTitleComponent: React.FC<MetaTitleProps> = (props) => {
|
||||
label,
|
||||
required,
|
||||
},
|
||||
field: fieldFromProps,
|
||||
hasGenerateTitleFn,
|
||||
labelProps,
|
||||
} = props || {}
|
||||
const { path: pathFromContext } = useFieldProps()
|
||||
|
||||
const { t } = useTranslation<PluginSEOTranslations, PluginSEOTranslationKeys>()
|
||||
|
||||
const field: FieldType<string> = useField({
|
||||
@@ -98,7 +98,13 @@ export const MetaTitleComponent: React.FC<MetaTitleProps> = (props) => {
|
||||
}}
|
||||
>
|
||||
<div className="plugin-seo__field">
|
||||
<FieldLabel field={null} Label={Label} label={label} {...(labelProps || {})} />
|
||||
<FieldLabel
|
||||
field={fieldFromProps}
|
||||
Label={Label}
|
||||
label={label}
|
||||
required={required}
|
||||
{...(labelProps || {})}
|
||||
/>
|
||||
{hasGenerateTitleFn && (
|
||||
<React.Fragment>
|
||||
—
|
||||
@@ -150,7 +156,6 @@ export const MetaTitleComponent: React.FC<MetaTitleProps> = (props) => {
|
||||
Component: null,
|
||||
RenderedComponent: errorMessage,
|
||||
}}
|
||||
label={label}
|
||||
onChange={setValue}
|
||||
path={pathFromContext}
|
||||
required={required}
|
||||
|
||||
@@ -78,7 +78,11 @@ export const PreviewComponent: React.FC<PreviewProps> = (props) => {
|
||||
}, [fields, href, locale, docInfo, hasGenerateURLFn, getData])
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div
|
||||
style={{
|
||||
marginBottom: '20px',
|
||||
}}
|
||||
>
|
||||
<div>{t('plugin-seo:preview')}</div>
|
||||
<div
|
||||
style={{
|
||||
|
||||
@@ -28,7 +28,7 @@ export const seoPlugin =
|
||||
OverviewField({}),
|
||||
MetaTitleField({
|
||||
hasGenerateFn: typeof pluginConfig?.generateTitle === 'function',
|
||||
overrides: pluginConfig?.fieldOverrides?.title as unknown as TextField,
|
||||
overrides: pluginConfig?.fieldOverrides?.title,
|
||||
}),
|
||||
MetaDescriptionField({
|
||||
hasGenerateFn: typeof pluginConfig?.generateDescription === 'function',
|
||||
|
||||
@@ -65,6 +65,9 @@ export const PagesWithImportedFields: CollectionConfig = {
|
||||
fields: [
|
||||
MetaTitleField({
|
||||
hasGenerateFn: true,
|
||||
overrides: {
|
||||
required: true,
|
||||
},
|
||||
}),
|
||||
PreviewField({
|
||||
hasGenerateFn: true,
|
||||
|
||||
Reference in New Issue
Block a user