From 0775eb792780de0d508ce3835320194eb3f10aae Mon Sep 17 00:00:00 2001 From: ClovertaTheTrilobita Date: Mon, 13 Apr 2026 01:42:40 +0300 Subject: [PATCH] Added tags to postItem --- src/components/Navigation.astro | 2 +- src/components/Posts/PostItem.astro | 131 ++++++++++++++++++++++------ src/components/Posts/PostList.astro | 1 + src/pages/[lang]/tags/[tag].astro | 1 + src/pages/[lang]/tags/index.astro | 14 +++ 5 files changed, 122 insertions(+), 27 deletions(-) diff --git a/src/components/Navigation.astro b/src/components/Navigation.astro index ca83096..7e21097 100644 --- a/src/components/Navigation.astro +++ b/src/components/Navigation.astro @@ -143,7 +143,7 @@ const t = getTranslations(lang); color: white; } - @media (max-width: 768px) { + @media (max-width: 700px) { .site-nav-desktop { display: none; } diff --git a/src/components/Posts/PostItem.astro b/src/components/Posts/PostItem.astro index fae618e..a060a9a 100644 --- a/src/components/Posts/PostItem.astro +++ b/src/components/Posts/PostItem.astro @@ -1,14 +1,32 @@ --- import "@/styles/global.css"; import Remark42Count from "@/components/remark42-counter.svelte"; +import { getLangFromUrl } from "@/i18n"; + +const lang = getLangFromUrl(Astro.url); const data = Astro.props; +const tags = data.tags; ---
  • - +
    - {data.title} - {data.description} + + {data.title} + + + + {data.description} + +
    + { + tags.map((tag: string) => ( +

    + {tag} +

    + )) + } +
    - {data.title} - + + {data.title} + +
  • diff --git a/src/components/Posts/PostList.astro b/src/components/Posts/PostList.astro index 327c775..987662b 100644 --- a/src/components/Posts/PostList.astro +++ b/src/components/Posts/PostList.astro @@ -37,6 +37,7 @@ const latestPosts = filteredPosts.slice(0, 5); description={post.data.description} date={formattedDate} img={post.data.image.url} + tags={post.data.tags} /> ); }) diff --git a/src/pages/[lang]/tags/[tag].astro b/src/pages/[lang]/tags/[tag].astro index b2d0b09..e2da483 100644 --- a/src/pages/[lang]/tags/[tag].astro +++ b/src/pages/[lang]/tags/[tag].astro @@ -53,6 +53,7 @@ const t = getTranslations(lang); title={post.data.title} date={formattedDate} img={post.data.image.url} + tags={post.data.tags} /> ); }) diff --git a/src/pages/[lang]/tags/index.astro b/src/pages/[lang]/tags/index.astro index d841e1c..e816e66 100644 --- a/src/pages/[lang]/tags/index.astro +++ b/src/pages/[lang]/tags/index.astro @@ -39,6 +39,19 @@ const pageTitle = lang === "zh" ? "标签索引" : "Tag Index"; } .tag { + font-family: + system-ui, + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + Roboto, + Oxygen, + Ubuntu, + Cantarell, + "Open Sans", + "Helvetica Neue", + sans-serif; + margin: 0; padding: 0.22em 0.65em; font-size: 1rem; @@ -51,6 +64,7 @@ const pageTitle = lang === "zh" ? "标签索引" : "Tag Index"; .tag a { color: #6f4e37; text-decoration: none; + font-weight: 500; } .tag a:hover {