--- import Layout from './Layout.astro'; 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'; import TableOfContents from '@/components/layout/TableOfContents.astro'; import BlogNavigation from '@/components/layout/BlogNavigation.astro'; import PostMeta from '@/components/blog/PostMeta.astro'; import Container from '../components/ui/Container'; import GiscusComments from '@/components/blog/GiscusComments'; // Use Astro's MarkdownLayoutProps for proper type safety export type Props = MarkdownLayoutProps; // Access frontmatter data correctly for markdown layouts const { frontmatter } = Astro.props; const { title, description, publishDate, date, tags, tagId, category, categoryId, readTime, } = 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; const finalReadingTime = readTime ? parseInt(readTime.replace(/\D/g, '')) : undefined; ---
{t('blog.backToList')}

{title}

{description && (

{description}

)}