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')} + +