From d22174e0dc2390c7579b06fff0823ffbb9a1fd4c Mon Sep 17 00:00:00 2001 From: joyzhao Date: Mon, 16 Jun 2025 22:30:40 +0800 Subject: [PATCH] refactor(blog): update blog post layouts and remove index pages - Replace BlogLayout with new BlogPostLayout for better post styling - Remove unused blog post index pages - Add new blog post layout with enhanced typography and metadata --- src/layouts/BlogLayout.astro | 6 +- src/layouts/BlogPostLayout.astro | 125 ++++++++++++++++++ src/pages/blog/posts/index.astro | 22 --- src/pages/blog/posts/mastering-react-hooks.md | 2 +- src/pages/blog/posts/modern-ui-tailwind.md | 2 +- src/pages/blog/posts/scaling-nodejs-docker.md | 2 +- .../blog/posts/typescript-best-practices.md | 2 +- src/pages/zh/blog/posts/index.astro | 22 --- .../zh/blog/posts/mastering-react-hooks.md | 2 +- src/pages/zh/blog/posts/modern-ui-tailwind.md | 2 +- .../zh/blog/posts/scaling-nodejs-docker.md | 2 +- .../blog/posts/typescript-best-practices.md | 2 +- 12 files changed, 134 insertions(+), 57 deletions(-) create mode 100644 src/layouts/BlogPostLayout.astro delete mode 100644 src/pages/blog/posts/index.astro delete mode 100644 src/pages/zh/blog/posts/index.astro diff --git a/src/layouts/BlogLayout.astro b/src/layouts/BlogLayout.astro index de916bd..dda3ffd 100644 --- a/src/layouts/BlogLayout.astro +++ b/src/layouts/BlogLayout.astro @@ -40,11 +40,7 @@ const lang = Astro.currentLocale as Lang || defaultLang;
-
-
- -
-
+
diff --git a/src/layouts/BlogPostLayout.astro b/src/layouts/BlogPostLayout.astro new file mode 100644 index 0000000..1489c3c --- /dev/null +++ b/src/layouts/BlogPostLayout.astro @@ -0,0 +1,125 @@ +--- +import { type Lang } from '@/i18n/utils'; +import { defaultLang } from '@/i18n/ui'; +import GlassHeader from '@/components/GlassHeader'; +import Footer from '@/components/Footer'; +import "../styles/global.css"; + +export interface Props { + title: string; + description?: string; + publishDate?: string; + author?: string; +} + +const { + title, + description = 'Explore my latest thoughts on coding, tech trends, and developer life.', + publishDate, + author = 'Zhao Guiyang' +} = Astro.props; +const lang = Astro.currentLocale as Lang || defaultLang; +--- + + + + + + + + + + {title} + + + + + +
+
+ + + + +
+
+ +
+

{title}

+ {publishDate && ( +
+ +
+ )} + {author && ( +
+ By {author} +
+ )} +
+ + +
+ +
+
+
+ + +