From b4a8d13cdd2d4c3e2e982e4a652d2d2d354e0026 Mon Sep 17 00:00:00 2001 From: joyzhao Date: Thu, 19 Jun 2025 17:37:48 +0800 Subject: [PATCH] refactor(layouts): extract common layout components to base template Move shared HTML structure, head metadata, and theme scripts to Layout.astro Remove duplicate code from BlogLayout, BlogPostLayout, and AboutLayout Keep page-specific content and styling in individual layout files --- src/layouts/AboutLayout.astro | 179 +++++++++------------------- src/layouts/BlogLayout.astro | 101 +++------------- src/layouts/BlogPostLayout.astro | 195 ++++++++++--------------------- 3 files changed, 141 insertions(+), 334 deletions(-) diff --git a/src/layouts/AboutLayout.astro b/src/layouts/AboutLayout.astro index 755f761..f1f1883 100644 --- a/src/layouts/AboutLayout.astro +++ b/src/layouts/AboutLayout.astro @@ -1,10 +1,10 @@ --- +import Layout from './Layout.astro'; import type { MarkdownLayoutProps } from 'astro'; import { type Lang, type FrontmatterProps } from '@/types'; import { defaultLang } from '@/i18n/ui'; import GlassHeader from '@/components/GlassHeader'; import Footer from '@/components/Footer'; -import "../styles/global.css"; // Use Astro's MarkdownLayoutProps for proper type safety export type Props = MarkdownLayoutProps; @@ -16,93 +16,73 @@ const { title, description } = frontmatter; const lang = Astro.currentLocale as Lang || defaultLang; --- - - - - - - - - - {title} - - - - - - -
- -
-
- -
-
+ + +
+ +
- - - - - -
-
-
-
- -
- -
-

- ✨ {title} -

- - {description && ( -

- 📝 {description} -

- )} -
+
+ + + + + +
+
+
+
+ +
+ +
+

+ ✨ {title} +

- -
- -
-
+ {description && ( +

+ 📝 {description} +

+ )} + - -
- - -
- - +
+ + +