Skip to content

Commit 0df5e4f

Browse files
authored
fix: Content: SEO Meta Description Displays that there are excess characters when there are none (#2534)
* seo meta descirptions * add isSaving as dependency * removing the useEffect, making use the uesEffect inside ItemSettings of removing errors when there are errors while saving * removing isSaving prop * remove useEffect import * update slice number of text in metakeywords
1 parent c05b437 commit 0df5e4f

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

src/apps/content-editor/src/app/views/ItemEdit/Meta/ItemSettings/ItemSettings.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { memo, Fragment, useCallback, useMemo, useState } from "react";
1+
import {
2+
memo,
3+
Fragment,
4+
useCallback,
5+
useMemo,
6+
useState,
7+
useEffect,
8+
} from "react";
29
import { useSelector } from "react-redux";
310
import { useDispatch } from "react-redux";
411

@@ -75,6 +82,13 @@ export const ItemSettings = memo(
7582
[meta.ZUID, errors]
7683
);
7784

85+
useEffect(() => {
86+
if (props.saving) {
87+
setErrors({});
88+
return;
89+
}
90+
}, [props.saving]);
91+
7892
return (
7993
<section className={styles.Meta}>
8094
<main className={styles.MetaMain}>

src/apps/content-editor/src/app/views/ItemEdit/Meta/Meta.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export function Meta(props) {
1818
item={props.item}
1919
content={props.items}
2020
dispatch={props.dispatch}
21+
saving={props.saving}
2122
/>
2223
)}
2324
</div>

src/shell/store/content.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,15 @@ export function saveItem(itemZUID, action = "") {
408408
if (item.web.metaDescription) {
409409
item.web.metaDescription = item.web.metaDescription.slice(0, 160);
410410
}
411-
411+
if (item.web.metaTitle) {
412+
item.web.metaTitle = item.web.metaTitle.slice(0, 150);
413+
}
414+
if (item.web.metaLinkText) {
415+
item.web.metaLinkText = item.web.metaLinkText.slice(0, 150);
416+
}
417+
if (item.web.metaKeywords) {
418+
item.web.metaKeywords = item.web.metaKeywords.slice(0, 255);
419+
}
412420
/*
413421
Nav item will not be found if item does exist in the nav such is the case
414422
when the item is in a dataset

0 commit comments

Comments
 (0)