Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit c7f7037

Browse files
committed
adjust ogImage code since there's only ever 1 image
1 parent 02d7584 commit c7f7037

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

components/common/Layout.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ import PropTypes from 'prop-types'
1616
* @return {Element} The Layout component.
1717
*/
1818
export default function Layout({children, seo, hasJsonLd}) {
19-
// Define SEO image prop.
20-
const seoImages = !seo?.opengraphImage?.sourceUrl
21-
? null
22-
: [
23-
{
24-
url: seo?.opengraphImage.sourceUrl
25-
}
26-
]
27-
2819
return (
2920
<>
3021
<NextSeo
@@ -33,7 +24,7 @@ export default function Layout({children, seo, hasJsonLd}) {
3324
openGraph={{
3425
title: seo?.title,
3526
description: seo?.metaDesc,
36-
images: seoImages ? [...seoImages] : null,
27+
images: [{url: seo?.opengraphImage.sourceUrl}],
3728
url: seo?.canonical
3829
}}
3930
nofollow={'follow' !== seo?.metaRobotsNofollow}
@@ -43,7 +34,7 @@ export default function Layout({children, seo, hasJsonLd}) {
4334
<BlogJsonLd
4435
url={seo?.canonical}
4536
title={seo?.title}
46-
images={seoImages ? [...seoImages] : []}
37+
images={[seo?.opengraphImage.sourceUrl]}
4738
datePublished={seo?.opengraphPublishedTime}
4839
dateModified={seo?.opengraphModifiedTime}
4940
authorName={seo?.opengraphAuthor}

0 commit comments

Comments
 (0)