From a0c13634f970d1361248d628c70d1a4e6a99cdc3 Mon Sep 17 00:00:00 2001 From: ClovertaTheTrilobita Date: Wed, 25 Mar 2026 09:25:40 +0200 Subject: [PATCH] added style to posts --- astro.config.mjs | 5 +- src/components/ThemeIcon.astro | 48 +++++----- src/i18n/en.ts | 2 +- src/layouts/MarkdownPostLayout.astro | 135 +++++++++++++++++++++++---- 4 files changed, 146 insertions(+), 44 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 7b5a8e9..cb817e9 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -12,5 +12,8 @@ export default defineConfig({ }, }, }, - site: "https://blog.cloverta.top" + site: "https://blog.cloverta.top", + redirects: { + "/": "/zh", + }, }) diff --git a/src/components/ThemeIcon.astro b/src/components/ThemeIcon.astro index 4ecb7e7..259635e 100644 --- a/src/components/ThemeIcon.astro +++ b/src/components/ThemeIcon.astro @@ -103,34 +103,38 @@ const switchHref = "/" + segments.join("/"); diff --git a/src/i18n/en.ts b/src/i18n/en.ts index ff42ee3..fbda9ad 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -19,7 +19,7 @@ export default { }, langSwitcher: "δΈ­ζ–‡", home: { - title: "Welcome in β€” mind the turn to the left", + title: "Welcome in β€” please mind the gap", content: [ "These few lines speak what the heart would say; Ink and paper end, but thoughts still stay", "Welcome to Cloverta's blog.", diff --git a/src/layouts/MarkdownPostLayout.astro b/src/layouts/MarkdownPostLayout.astro index a24919a..73aae16 100644 --- a/src/layouts/MarkdownPostLayout.astro +++ b/src/layouts/MarkdownPostLayout.astro @@ -1,47 +1,142 @@ --- import BaseLayout from "./BaseLayout.astro"; import Giscus from "@/components/Giscus.astro"; +import { getLangFromUrl, getTranslations } from "@/i18n"; import "@/styles/global.css"; + const { frontmatter } = Astro.props; +const lang = getLangFromUrl(Astro.url); +const t = getTranslations(lang); --- -

{frontmatter.title}

-

{frontmatter.pubDate.toLocaleDateString()}

-

{frontmatter.description}

-

Written by: {frontmatter.author}

- {frontmatter.image.alt} +
+ +