diff --git a/src/layouts/PostLayout.astro b/src/layouts/PostLayout.astro index cda1d9c..83c556d 100644 --- a/src/layouts/PostLayout.astro +++ b/src/layouts/PostLayout.astro @@ -3,68 +3,21 @@ import Layout from "./Layout.astro"; import config from "@/config"; import Twikoo from '@/components/Twikoo.astro'; -type Props = { - title?: string; - description?: string; - ogImage?: string; - canonicalURL?: string; - pubDatetime?: Date; - modDatetime?: Date | null; -}; - -const { site } = config; - -const { title, description, ogImage, canonicalURL, pubDatetime, modDatetime } = - Astro.props; - -const structuredData = { - "@context": "https://schema.org", - "@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 }), - }, - ], -}; +// ... 前面的 props 和 structuredData 代码保持不变 ... --- - - - { - pubDatetime && ( - - ) - } - { - modDatetime && ( - - ) - } - -