feat: add back json ld
This commit is contained in:
+18
-1
@@ -17,6 +17,7 @@ import rehypeKatex from 'rehype-katex'
|
||||
import rehypeCitation from 'rehype-citation'
|
||||
import rehypePrismPlus from 'rehype-prism-plus'
|
||||
import rehypePresetMinify from 'rehype-preset-minify'
|
||||
import siteMetadata from './data/siteMetadata'
|
||||
|
||||
const root = process.cwd()
|
||||
|
||||
@@ -54,7 +55,23 @@ export const Blog = defineDocumentType(() => ({
|
||||
bibliography: { 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(() => ({
|
||||
|
||||
Reference in New Issue
Block a user