diff --git a/src/layouts/PostLayout.astro b/src/layouts/PostLayout.astro index 2c02478..cda1d9c 100644 --- a/src/layouts/PostLayout.astro +++ b/src/layouts/PostLayout.astro @@ -1,7 +1,7 @@ --- import Layout from "./Layout.astro"; import config from "@/config"; -import TwikooComments from "../components/TwikooComments.astro"; +import Twikoo from '@/components/Twikoo.astro'; type Props = { title?: string; @@ -13,41 +13,58 @@ type Props = { }; const { site } = config; -const { title, description, ogImage, canonicalURL, pubDatetime, modDatetime } = Astro.props; -const commentPath = Astro.url.pathname; +const { title, description, ogImage, canonicalURL, pubDatetime, modDatetime } = + Astro.props; -// 结构化数据(保持你原来的实现,此处仅作示例) const structuredData = { "@context": "https://schema.org", - "@type": "Article", - headline: title, - description: description, - // ... 其他字段按你的原有逻辑填充 + "@type": "BlogPosting", + headline: title ?? site.title, + image: ogImage, + ...(pubDatetime && { datePublished: pubDatetime.toISOString() }), + ...(modDatetime && { dateModified: modDatetime.toISOString() }), + author: [ + { + "@type": "Person", + name: site.author, + ...(site.profile && { url: site.profile }), + }, + ], }; --- + - {pubDatetime && ( - - )} - {modDatetime && ( - - )} -