SanYeCao-blog/src/pages/[lang]/index.astro

40 lines
915 B
Text
Raw Normal View History

2026-03-24 22:28:23 +00:00
---
import BaseLayout from "@/layouts/BaseLayout.astro";
import PostList from "@/components/Posts/PostList.astro";
2026-03-24 23:13:44 +00:00
import { getLangFromUrl, getTranslations } from "@/i18n";
2026-03-24 22:28:23 +00:00
import "@/styles/global.css";
export function getStaticPaths() {
return [{ params: { lang: "zh" } }, { params: { lang: "en" } }];
}
2026-03-24 23:13:44 +00:00
const lang = getLangFromUrl(Astro.url);
const t = getTranslations(lang);
2026-03-24 23:40:19 +00:00
const headerTitle = lang === "zh" ? "Cloverta的博客" : "Cloverta's blog";
2026-03-24 23:13:44 +00:00
const pageTitle = t.home.title;
2026-03-24 22:28:23 +00:00
---
2026-03-24 23:40:19 +00:00
<BaseLayout pageTitle={headerTitle}>
2026-03-24 23:13:44 +00:00
<h1>{pageTitle}</h1>
<div class="content">
{t.home.content.map((line: string) => <p set:html={line} />)}
</div>
2026-03-24 23:40:19 +00:00
<div class="section-divider"></div>
2026-03-24 22:28:23 +00:00
<PostList />
</BaseLayout>
2026-03-24 23:40:19 +00:00
<style>
.section-divider {
height: 1px;
background: #cdd2d8;
margin: 1.5rem 0;
opacity: 0.8;
}
:global(.dark) .section-divider {
background: #7f8b97;
}
</style>