From bf37f4615c0e393a783613b6d77638fb2278334f Mon Sep 17 00:00:00 2001 From: QihanNX Date: Tue, 16 Jun 2026 17:27:17 +0800 Subject: [PATCH] Update PostLayout.astro --- src/layouts/PostLayout.astro | 63 +++++------------------------------- 1 file changed, 8 insertions(+), 55 deletions(-) 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 && ( - - ) - } - -