upstream #1
@ -79,6 +79,13 @@ export default async function Page({ params }: { params: { slug: string[] } }) {
|
|||||||
return coreContent(authorResults as Authors)
|
return coreContent(authorResults as Authors)
|
||||||
})
|
})
|
||||||
const mainContent = coreContent(post)
|
const mainContent = coreContent(post)
|
||||||
|
const jsonLd = post.structuredData
|
||||||
|
jsonLd['author'] = authorDetails.map((author) => {
|
||||||
|
return {
|
||||||
|
'@type': 'Person',
|
||||||
|
name: author.name,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -92,9 +99,14 @@ export default async function Page({ params }: { params: { slug: string[] } }) {
|
|||||||
</PageTitle>
|
</PageTitle>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<PostLayout content={mainContent} authorDetails={authorDetails} next={next} prev={prev}>
|
<>
|
||||||
<Mdx code={post.body.code} toc={post.toc} />
|
<script type="application/ld+json" suppressHydrationWarning>
|
||||||
</PostLayout>
|
{JSON.stringify(jsonLd)}
|
||||||
|
</script>
|
||||||
|
<PostLayout content={mainContent} authorDetails={authorDetails} next={next} prev={prev}>
|
||||||
|
<Mdx code={post.body.code} toc={post.toc} />
|
||||||
|
</PostLayout>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
@ -17,6 +17,7 @@ import rehypeKatex from 'rehype-katex'
|
|||||||
import rehypeCitation from 'rehype-citation'
|
import rehypeCitation from 'rehype-citation'
|
||||||
import rehypePrismPlus from 'rehype-prism-plus'
|
import rehypePrismPlus from 'rehype-prism-plus'
|
||||||
import rehypePresetMinify from 'rehype-preset-minify'
|
import rehypePresetMinify from 'rehype-preset-minify'
|
||||||
|
import siteMetadata from './data/siteMetadata'
|
||||||
|
|
||||||
const root = process.cwd()
|
const root = process.cwd()
|
||||||
|
|
||||||
@ -54,7 +55,23 @@ export const Blog = defineDocumentType(() => ({
|
|||||||
bibliography: { type: 'string' },
|
bibliography: { type: 'string' },
|
||||||
canonicalUrl: { type: 'string' },
|
canonicalUrl: { type: 'string' },
|
||||||
},
|
},
|
||||||
computedFields,
|
computedFields: {
|
||||||
|
...computedFields,
|
||||||
|
structuredData: {
|
||||||
|
type: 'json',
|
||||||
|
resolve: (doc) => ({
|
||||||
|
'@context': 'https://schema.org',
|
||||||
|
'@type': 'BlogPosting',
|
||||||
|
headline: doc.title,
|
||||||
|
datePublished: doc.date,
|
||||||
|
dateModified: doc.lastmod || doc.date,
|
||||||
|
description: doc.summary,
|
||||||
|
image: doc.images ? doc.images[0] : siteMetadata.socialBanner,
|
||||||
|
url: `${siteMetadata.siteUrl}/${doc._raw.flattenedPath}`,
|
||||||
|
author: doc.authors,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
export const Authors = defineDocumentType(() => ({
|
export const Authors = defineDocumentType(() => ({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user