diff --git a/src/components/atoms/SEO/MetaTags.tsx b/src/components/atoms/SEO/MetaTags.tsx index d2f139e7..e75ef5da 100644 --- a/src/components/atoms/SEO/MetaTags.tsx +++ b/src/components/atoms/SEO/MetaTags.tsx @@ -19,13 +19,17 @@ export default function MetaTags({ image, url, postSEO, - title + title, + datePublished, + dateModified }: { description: string image: string url: string postSEO: boolean title: string + datePublished: string + dateModified: string }) { const { siteTitle, siteDescription, siteUrl, author } = useSiteMetadata() @@ -40,7 +44,17 @@ export default function MetaTags({ - {schemaOrg(siteUrl, title, postSEO, url, image, description, author.name)} + {schemaOrg( + siteUrl, + title, + postSEO, + url, + image, + description, + author.name, + datePublished, + dateModified + )} diff --git a/src/components/atoms/SEO/index.tsx b/src/components/atoms/SEO/index.tsx index 6204be78..3ff7fb05 100644 --- a/src/components/atoms/SEO/index.tsx +++ b/src/components/atoms/SEO/index.tsx @@ -60,6 +60,8 @@ export default function SEO({ url={url} postSEO={postSEO} title={title} + datePublished={post && post.fields && post.fields.date} + dateModified={post && post.frontmatter.updated} /> ) } diff --git a/src/components/atoms/SEO/schemaOrg.tsx b/src/components/atoms/SEO/schemaOrg.tsx index feb28787..b422cd8a 100644 --- a/src/components/atoms/SEO/schemaOrg.tsx +++ b/src/components/atoms/SEO/schemaOrg.tsx @@ -7,12 +7,14 @@ export default function schemaOrg( postURL: string, image: string, description: string, - author?: string + author: string, + datePublished: string, + dateModified: string ) { const schemaOrgJSONLD: any = [ { '@context': 'http://schema.org', - '@type': 'WebSite', + '@type': 'Blog', url: blogURL, name: title } @@ -22,8 +24,14 @@ export default function schemaOrg( schemaOrgJSONLD.push({ '@context': 'http://schema.org', '@type': 'BlogPosting', - author, - publisher: author, + author: { + '@type': 'Person', + name: author + }, + publisher: { + '@type': 'Organization', + name: author + }, url: postURL, name: title, headline: title, @@ -31,7 +39,13 @@ export default function schemaOrg( '@type': 'ImageObject', url: image }, - description + description, + datePublished, + dateModified: dateModified || datePublished, + mainEntityOfPage: { + '@type': 'Blog', + '@id': blogURL + } }) }