refactor homepage

This commit is contained in:
ClovertaTheTrilobita 2026-03-25 01:13:44 +02:00
parent f837ae5fb5
commit ba14a5eec7
10 changed files with 23 additions and 7 deletions

View file

@ -19,7 +19,11 @@ export default {
}, },
langSwitcher: "中文", langSwitcher: "中文",
home: { home: {
content: "" title: "Welcome in — mind the turn to the left",
content: [
"These few lines speak what the heart would say; Ink and paper end, but thoughts still stay",
"Welcome to Cloverta's blog.",
]
}, },
about: { about: {
title: "About Me, and This Blog", title: "About Me, and This Blog",
@ -41,7 +45,8 @@ export default {
] ]
}, },
tags: { tags: {
title: "Tags" title: "Tags",
description: "All tags that have appeared across the blog are collected here. Click a tag to jump to the corresponding list of posts."
}, },
footer: { footer: {
githubIntro: 'See more on <a href="https://www.github.com/ClovertaTheTrilobita">GitHub</a>!', githubIntro: 'See more on <a href="https://www.github.com/ClovertaTheTrilobita">GitHub</a>!',

View file

@ -19,7 +19,11 @@ export default {
}, },
langSwitcher: "EN", langSwitcher: "EN",
home: { home: {
content: "" title: "欢迎光临,请进门左转",
content: [
"见字如晤,展信舒颜。楮墨有限,不尽欲言。",
"欢迎来到三叶的博客。",
]
}, },
about: { about: {
title: "关于我,和这个博客", title: "关于我,和这个博客",
@ -41,7 +45,8 @@ export default {
] ]
}, },
tags: { tags: {
title: "标签" title: "标签",
description: "在这里收集着整篇博客出现过的标签,点击标签跳转对应的文章列表。"
}, },
footer: { footer: {
githubIntro: '在 <a href="https://www.github.com/ClovertaTheTrilobita">GitHub</a> 查看更多!', githubIntro: '在 <a href="https://www.github.com/ClovertaTheTrilobita">GitHub</a> 查看更多!',

View file

@ -1,17 +1,22 @@
--- ---
import BaseLayout from "@/layouts/BaseLayout.astro"; import BaseLayout from "@/layouts/BaseLayout.astro";
import PostList from "@/components/Posts/PostList.astro"; import PostList from "@/components/Posts/PostList.astro";
import { getLangFromUrl, getTranslations } from "@/i18n";
import "@/styles/global.css"; import "@/styles/global.css";
export function getStaticPaths() { export function getStaticPaths() {
return [{ params: { lang: "zh" } }, { params: { lang: "en" } }]; return [{ params: { lang: "zh" } }, { params: { lang: "en" } }];
} }
const { lang } = Astro.params; const lang = getLangFromUrl(Astro.url);
const pageTitle = "Homepage"; const t = getTranslations(lang);
const pageTitle = t.home.title;
--- ---
<BaseLayout pageTitle={pageTitle}> <BaseLayout pageTitle={pageTitle}>
<h1>My Astro Site</h1> <h1>{pageTitle}</h1>
<div class="content">
{t.home.content.map((line: string) => <p set:html={line} />)}
</div>
<PostList /> <PostList />
</BaseLayout> </BaseLayout>

View file

@ -17,6 +17,7 @@ const pageTitle = lang === "zh" ? "标签索引" : "Tag Index";
<BaseLayout pageTitle={pageTitle}> <BaseLayout pageTitle={pageTitle}>
<h1>{t.tags.title}</h1> <h1>{t.tags.title}</h1>
<p>{t.tags.description}</p>
<div class="tags"> <div class="tags">
{ {
tags.map((tag) => ( tags.map((tag) => (