Update PostLayout.astro

This commit is contained in:
2026-06-16 22:21:39 +08:00
committed by GitHub
parent eec698acd2
commit 2e852d725d
+9 -5
View File
@@ -1,7 +1,7 @@
--- ---
import Layout from "./Layout.astro"; import Layout from "./Layout.astro";
import config from "@/config"; import config from "@/config";
import Comment from "../components/Comment.astro"; // 新增评论组件 import Comment from "../components/Comment.astro";
type Props = { type Props = {
title?: string; title?: string;
@@ -36,9 +36,7 @@ const structuredData = {
<Layout {title} {description} {ogImage} {canonicalURL}> <Layout {title} {description} {ogImage} {canonicalURL}>
<Fragment slot="head"> <Fragment slot="head">
<!-- Override og:type for article pages -->
<meta property="og:type" content="article" /> <meta property="og:type" content="article" />
{ {
pubDatetime && ( pubDatetime && (
<meta <meta
@@ -55,7 +53,6 @@ const structuredData = {
/> />
) )
} }
<script <script
type="application/ld+json" type="application/ld+json"
is:inline is:inline
@@ -63,6 +60,13 @@ const structuredData = {
/> />
</Fragment> </Fragment>
<!-- 文章内容(保持原有结构) -->
<article class="prose prose-lg max-w-3xl mx-auto px-4">
<slot /> <slot />
<Comment /> <!-- 文章内容下方直接放置评论 --> </article>
<!-- 👇 评论区域:应用与文章相同的宽度和居中样式 -->
<div class="max-w-3xl mx-auto px-4 mt-8 w-full">
<Comment />
</div>
</Layout> </Layout>