feat: add dynamic descript to meta head (#56)

* feat: add dynamic descript to meta head

* revert code
This commit is contained in:
CorrectRoad 2024-04-23 00:04:43 +08:00 committed by GitHub
parent 6d9259808a
commit 582e76cf43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 10 additions and 8 deletions

View File

@ -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) {
<title>{pageTitle}</title>
<meta charset="UTF-8" />
<meta name="description" content="Astro description">
<meta name="description" content={description || pageTitle}>
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<link rel="icon" media="(prefers-color-scheme: light)" href="/favicon/favicon-light-32.png" sizes="32x32">

View File

@ -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
---
<Layout title={title} banner={banner}>
<Layout title={title} banner={banner} description={description}>
<div class="max-w-[var(--page-width)] min-h-screen grid grid-cols-[17.5rem_auto] grid-rows-[auto_auto_1fr_auto] lg:grid-rows-[auto_1fr_auto]
mx-auto gap-4 relative px-0 md:px-4"
>

View File

@ -12,7 +12,7 @@ const aboutPost = await getEntry('spec', 'about')
const { Content } = await aboutPost.render()
---
<MainGridLayout title={i18n(I18nKey.about)}>
<MainGridLayout title={i18n(I18nKey.about)} description={i18n(I18nKey.about)}>
<div class="flex w-full rounded-[var(--radius-large)] overflow-hidden relative min-h-32">
<div class="card-base z-10 px-9 py-6 relative w-full ">
<Markdown class="mt-2">

View File

@ -20,6 +20,6 @@ const { category } = Astro.params;
---
<MainGridLayout title={i18n(I18nKey.archive)}>
<MainGridLayout title={i18n(I18nKey.archive)} description={i18n(I18nKey.archive)}>
<ArchivePanel categories={[category]}></ArchivePanel>
</MainGridLayout>

View File

@ -29,6 +29,6 @@ const { tag } = Astro.params;
---
<MainGridLayout title={i18n(I18nKey.archive)}>
<MainGridLayout title={i18n(I18nKey.archive)} description={i18n(I18nKey.archive)}>
<ArchivePanel tags={[tag]}></ArchivePanel>
</MainGridLayout>

View File

@ -27,7 +27,7 @@ const { Content } = await entry.render();
const { remarkPluginFrontmatter } = await entry.render();
---
<MainGridLayout banner={entry.data.image} title={entry.data.title}>
<MainGridLayout banner={entry.data.image} title={entry.data.title} description={entry.data.description}>
<div class="flex w-full rounded-[var(--radius-large)] overflow-hidden relative mb-4">
<div id="post-container" class:list={["card-base z-10 px-6 md:px-9 pt-6 pb-4 relative w-full ",
{}