Skip to content

fix: Content: SEO Meta Description Displays that there are excess characters when there are none #2534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { memo, Fragment, useCallback, useMemo, useState } from "react";
import {
memo,
Fragment,
useCallback,
useMemo,
useState,
useEffect,
} from "react";
import { useSelector } from "react-redux";
import { useDispatch } from "react-redux";

Expand Down Expand Up @@ -75,6 +82,13 @@ export const ItemSettings = memo(
[meta.ZUID, errors]
);

useEffect(() => {
if (props.saving) {
setErrors({});
return;
}
}, [props.saving]);

return (
<section className={styles.Meta}>
<main className={styles.MetaMain}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function Meta(props) {
item={props.item}
content={props.items}
dispatch={props.dispatch}
saving={props.saving}
/>
)}
</div>
Expand Down
10 changes: 9 additions & 1 deletion src/shell/store/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,15 @@ export function saveItem(itemZUID, action = "") {
if (item.web.metaDescription) {
item.web.metaDescription = item.web.metaDescription.slice(0, 160);
}

if (item.web.metaTitle) {
item.web.metaTitle = item.web.metaTitle.slice(0, 150);
}
if (item.web.metaLinkText) {
item.web.metaLinkText = item.web.metaLinkText.slice(0, 150);
}
if (item.web.metaKeywords) {
item.web.metaKeywords = item.web.metaKeywords.slice(0, 250);
Copy link
Contributor

@finnar-bin finnar-bin Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it 250 here? The ui's character counter says it's 255. Probably worth checking in with @markelmad what the expected char limit here is.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done updating changes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glespinosa which character count did we settle on and why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shrunyan I'm basing on the UI
image

}
/*
Nav item will not be found if item does exist in the nav such is the case
when the item is in a dataset
Expand Down