Commit 43f0843
Changed files (6)
src
content
spec
layouts
pages
posts
src/content/spec/about.md
@@ -1,6 +1,7 @@
---
title: About
description: Welcome!
+comment: false
---
# Lorem
src/layouts/GridLayout.astro
@@ -5,11 +5,12 @@ interface Props {
title?: string;
description?: string;
lang?: string;
+ comment?: boolean;
}
-const { title, description, lang } = Astro.props;
+const { title, description, lang, comment } = Astro.props;
---
-<MainLayout title={title} description={description} lang={lang}>
+<MainLayout title={title} description={description} lang={lang} comment={comment}>
<div class="mx-auto flex max-w-screen-xl flex-col gap-4">
<slot name="header-content" />
<div class="flex gap-4">
src/layouts/MainLayout.astro
@@ -11,8 +11,9 @@ interface Props {
title?: string;
description?: string;
lang?: string;
+ comment?: boolean;
}
-const { title, description, lang } = Astro.props;
+const { title, description, lang, comment } = Astro.props;
---
<GlobalLayout title={title} description={description} lang={lang}>
@@ -25,6 +26,6 @@ const { title, description, lang } = Astro.props;
<!-- Main content -->
<slot />
</div>
- {searchConfig.enable && <Search />}
+ {searchConfig.enable && comment && <Search />}
<PageFooter />
</GlobalLayout>
src/pages/posts/[article].astro
@@ -24,7 +24,11 @@ const { Content, headings } = await render(article);
const wordCount = countWords(article.body || '');
---
-<GridLayout title={article.data.title} description={article.data.description}>
+<GridLayout
+ title={article.data.title}
+ description={article.data.description}
+ comment={article.data.comment}
+>
<Fragment slot="header-content">
<PostInfo
title={article.data.title}
src/pages/about.astro
@@ -13,7 +13,7 @@ const aboutMd = await getEntry('spec', 'about');
const { Content } = aboutMd ? await render(aboutMd) : Fragment;
---
-<MainLayout title={i18n(I18nKey.about)}>
+<MainLayout title={i18n(I18nKey.about)} comment={aboutMd?.data.comment}>
<div class="mx-auto flex max-w-screen-xl flex-col items-center justify-center">
<div class="my-4 flex w-5/6 flex-row items-center justify-between gap-4 md:w-2/3">
<div class="mb-5 mr-auto flex flex-col">
src/content.config.ts
@@ -29,6 +29,7 @@ const specCollection = defineCollection({
schema: z.object({
title: z.string().optional(),
description: z.string().optional(),
+ comment: z.boolean().optional().default(false),
}),
});