Skip to content
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

fix(og): fixed open graph field names #97

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -3,9 +3,6 @@ import { useIntl } from 'react-intl';

import isEqual from 'lodash/isEqual';
import isNull from 'lodash/isNull';
import isEmpty from 'lodash/isEmpty';

import { Box, Badge, Flex } from '@strapi/design-system';

import { SEOAccordion } from '../SEOAccordion';
import { SeoCheckerContext } from '../../Summary';
Expand All @@ -31,7 +28,7 @@ export const OpenGraphCheck = ({ openGraph, checks }) => {
}),
qualityVerdict: qualityVerdict.bad,
};
} else if (!openGraph['og:title'] || !openGraph['og:description'] || !openGraph['og:image']) {
} else if (!openGraph['ogTitle'] || !openGraph['ogDescription'] || !openGraph['ogImage']) {
status = {
message: formatMessage({
id: getTrad('SEOChecks.openGraphCheck.not-configured'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { useIntl } from 'react-intl';

import { Box, Flex, Typography, EmptyStateLayout, Badge, Modal } from '@strapi/design-system';
import { Badge, Box, EmptyStateLayout, Flex, Modal, Typography } from '@strapi/design-system';

import { Illo } from '../../../../HomePage/Main/EmptyComponentLayout/illo';

Expand All @@ -26,7 +26,7 @@ export const OpenGraphPreview = ({ modifiedData }) => {
</Typography>
</Modal.Header>
<Modal.Body>
{openGraph['og:title'] && openGraph['og:description'] && openGraph['og:image'] ? (
{openGraph['ogTitle'] && openGraph['ogDescription'] && openGraph['ogImage'] ? (
<>
<Flex alignItems="left" direction="column" gap={2}>
<Flex gap={1}>
Expand All @@ -36,9 +36,9 @@ export const OpenGraphPreview = ({ modifiedData }) => {
</Flex>
</Flex>
<FacebookOGPreview
title={openGraph['og:title']}
description={openGraph['og:description']}
image={openGraph['og:image']}
title={openGraph['ogTitle']}
description={openGraph['ogDescription']}
image={openGraph['ogImage']}
/>
<Flex alignItems="left" direction="column" gap={2}>
<Flex gap={1}>
Expand All @@ -48,9 +48,9 @@ export const OpenGraphPreview = ({ modifiedData }) => {
</Flex>
</Flex>
<TwitterOGPreview
title={openGraph['og:title']}
description={openGraph['og:description']}
image={openGraph['og:image']}
title={openGraph['ogTitle']}
description={openGraph['ogDescription']}
image={openGraph['ogImage']}
/>
<Flex alignItems="left" direction="column" gap={2}>
<Flex gap={1}>
Expand All @@ -60,9 +60,9 @@ export const OpenGraphPreview = ({ modifiedData }) => {
</Flex>
</Flex>
<LinkedInOGPreview
title={openGraph['og:title']}
description={openGraph['og:description']}
image={openGraph['og:image']}
title={openGraph['ogTitle']}
description={openGraph['ogDescription']}
image={openGraph['ogImage']}
/>
</>
) : (
Expand Down
2 changes: 1 addition & 1 deletion admin/src/components/CMEditView/utils/checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export const openGraphPreview = (modifiedData) => {
qualityVerdict: qualityVerdict.bad,
};
return status;
} else if (!openGraph['og:title'] || !openGraph['og:description'] || !openGraph['og:image']) {
} else if (!openGraph['ogTitle'] || !openGraph['ogDescription'] || !openGraph['ogImage']) {
status = {
message: '',
qualityVerdict: qualityVerdict.improvements,
Expand Down
12 changes: 6 additions & 6 deletions server/src/components/open-graph.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
},
"options": {},
"attributes": {
"og:title": {
"ogTitle": {
"type": "string",
"required": true,
"maxLength": 70
},
"og:description": {
"ogDescription": {
"type": "string",
"maxLength": 200,
"required": true
},
"og:image": {
"ogImage": {
"allowedTypes": [
"images"
],
"type": "media",
"multiple": false
},
"og:url": {
"ogUrl": {
"type": "string",
"required": false
},
"og:type": {
"ogType": {
"type": "string",
"required": false
}
}
}
}