Use authorDetails
to pull JSON-LD authors names
This commit is contained in:
parent
8d16a0c255
commit
e92b7d2737
@ -24,7 +24,7 @@ export const PageSeo = ({ title, description }) => {
|
||||
)
|
||||
}
|
||||
|
||||
export const BlogSeo = ({ authors = [], title, summary, date, lastmod, url, images = [] }) => {
|
||||
export const BlogSeo = ({ authorDetails, title, summary, date, lastmod, url, images = [] }) => {
|
||||
const router = useRouter()
|
||||
const publishedAt = new Date(date).toISOString()
|
||||
const modifiedAt = new Date(lastmod || date).toISOString()
|
||||
@ -42,11 +42,10 @@ export const BlogSeo = ({ authors = [], title, summary, date, lastmod, url, imag
|
||||
}
|
||||
})
|
||||
|
||||
let authorsArr = authors.length === 0 ? [siteMetadata.author] : authors
|
||||
const authorList = authorsArr.map((author) => {
|
||||
const authorList = authorDetails.map((author) => {
|
||||
return {
|
||||
'@type': 'Person',
|
||||
name: author,
|
||||
name: author.name,
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -19,7 +19,11 @@ export default function PostLayout({ frontMatter, authorDetails, next, prev, chi
|
||||
|
||||
return (
|
||||
<SectionContainer>
|
||||
<BlogSeo url={`${siteMetadata.siteUrl}/blog/${slug}`} {...frontMatter} />
|
||||
<BlogSeo
|
||||
url={`${siteMetadata.siteUrl}/blog/${slug}`}
|
||||
authorDetails={authorDetails}
|
||||
{...frontMatter}
|
||||
/>
|
||||
<article>
|
||||
<div className="xl:divide-y xl:divide-gray-200 xl:dark:divide-gray-700">
|
||||
<header className="pt-6 xl:pb-6">
|
||||
|
Loading…
x
Reference in New Issue
Block a user