From 582e76cf43eda6021812aae377e67326945f518c Mon Sep 17 00:00:00 2001 From: CorrectRoad Date: Tue, 23 Apr 2024 00:04:43 +0800 Subject: [PATCH] feat: add dynamic descript to meta head (#56) * feat: add dynamic descript to meta head * revert code --- src/layouts/Layout.astro | 5 +++-- src/layouts/MainGridLayout.astro | 5 +++-- src/pages/about.astro | 2 +- src/pages/archive/category/[category].astro | 2 +- src/pages/archive/tag/[tag].astro | 2 +- src/pages/posts/[...slug].astro | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index d32c646..60841bd 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -12,9 +12,10 @@ import {profileConfig, siteConfig} from "@/config"; interface Props { title: string; banner: string; + description?: string; } -let { title, banner } = Astro.props; +let { title, banner, description } = Astro.props; const isHomePage = pathsEqual(Astro.url.pathname, '/'); @@ -70,7 +71,7 @@ if (title) { {pageTitle} - + diff --git a/src/layouts/MainGridLayout.astro b/src/layouts/MainGridLayout.astro index c7cabc6..827a099 100644 --- a/src/layouts/MainGridLayout.astro +++ b/src/layouts/MainGridLayout.astro @@ -10,15 +10,16 @@ import {siteConfig} from "@/config"; interface Props { title: string; banner?: string; + description?: string; } -const { title, banner } = Astro.props +const { title, banner, description } = Astro.props const isHomePage = pathsEqual(Astro.url.pathname, '/') const enableBanner = siteConfig.banner.enable --- - +
diff --git a/src/pages/about.astro b/src/pages/about.astro index bcb52e2..476c631 100644 --- a/src/pages/about.astro +++ b/src/pages/about.astro @@ -12,7 +12,7 @@ const aboutPost = await getEntry('spec', 'about') const { Content } = await aboutPost.render() --- - +
diff --git a/src/pages/archive/category/[category].astro b/src/pages/archive/category/[category].astro index 5e053d3..88aa0d3 100644 --- a/src/pages/archive/category/[category].astro +++ b/src/pages/archive/category/[category].astro @@ -20,6 +20,6 @@ const { category } = Astro.params; --- - + diff --git a/src/pages/archive/tag/[tag].astro b/src/pages/archive/tag/[tag].astro index eecbc2c..ce132a4 100644 --- a/src/pages/archive/tag/[tag].astro +++ b/src/pages/archive/tag/[tag].astro @@ -29,6 +29,6 @@ const { tag } = Astro.params; --- - + diff --git a/src/pages/posts/[...slug].astro b/src/pages/posts/[...slug].astro index 5b65733..46400e4 100644 --- a/src/pages/posts/[...slug].astro +++ b/src/pages/posts/[...slug].astro @@ -27,7 +27,7 @@ const { Content } = await entry.render(); const { remarkPluginFrontmatter } = await entry.render(); --- - +