Fix and issue when authorDetails prop is empty

This commit is contained in:
Ahmad Al Maaz 2021-06-26 15:34:34 +03:00
parent e92b7d2737
commit 331461be12

View File

@ -42,12 +42,20 @@ export const BlogSeo = ({ authorDetails, title, summary, date, lastmod, url, ima
} }
}) })
const authorList = authorDetails.map((author) => { let authorList
return { if (authorDetails) {
authorList = authorDetails.map((author) => {
return {
'@type': 'Person',
name: author.name,
}
})
} else {
authorList = {
'@type': 'Person', '@type': 'Person',
name: author.name, name: siteMetadata.author,
} }
}) }
const structuredData = { const structuredData = {
'@context': 'https://schema.org', '@context': 'https://schema.org',