From 99c41d537f059f0e5aa37c454041088eadb11b44 Mon Sep 17 00:00:00 2001 From: joyzhao Date: Fri, 9 Jan 2026 09:45:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(blog):=20=E6=B7=BB=E5=8A=A0=E2=80=9C?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=8D=9A=E5=AE=A2=E5=88=97=E8=A1=A8=E2=80=9D?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=EF=BC=8C=E6=94=AF=E6=8C=81=E5=A4=9A=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/translations.ts | 2 ++ src/layouts/BlogPostLayout.astro | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts index 944bef6..93ff945 100644 --- a/src/i18n/translations.ts +++ b/src/i18n/translations.ts @@ -49,6 +49,7 @@ export const translations = { }, blog: { slogan: 'This is where innovative thinking meets complex problems.', + backToList: 'Back to Blog', }, services: { title: 'What I Do', @@ -105,6 +106,7 @@ export const translations = { }, blog: { slogan: '这里是创新思维与复杂问题相遇的地方。', + backToList: '返回博客列表', }, services: { title: '我能做什么', diff --git a/src/layouts/BlogPostLayout.astro b/src/layouts/BlogPostLayout.astro index 4fc3b07..8836b6f 100644 --- a/src/layouts/BlogPostLayout.astro +++ b/src/layouts/BlogPostLayout.astro @@ -4,6 +4,7 @@ import type { MarkdownLayoutProps } from 'astro'; import { type Lang } from '@/types/i18n'; import { type FrontmatterProps } from '@/types'; import { defaultLang } from '@/i18n/ui'; +import { useTranslations } from '@/i18n/utils'; import GlassHeader from '@/components/GlassHeader'; import Footer from '@/components/Footer'; import AuthorCard from '@/components/AuthorCard'; @@ -31,6 +32,9 @@ const { } = frontmatter; const lang = Astro.currentLocale as Lang || defaultLang; +const t = useTranslations(lang); + +const blogListUrl = lang === 'zh' ? '/zh/blog' : '/blog'; // Handle different field names for backward compatibility const finalPublishDate = publishDate || date; @@ -51,6 +55,23 @@ const finalReadingTime = readTime ? parseInt(readTime.replace(/\D/g, '')) : unde
+ + + + + {t('blog.backToList')} + +