@windcoder/astro-theme-orchid 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,40 +0,0 @@
1
- ---
2
- import { getCollection } from "astro:content";
3
- import BaseLayout from "virtual:theme/components/BaseLayout.astro";
4
- import { t } from "../../i18n/index.js";
5
- import { collectTags, formatDate, getSortedPosts } from "../../utils.js";
6
-
7
- // 先排序再聚合,保证每个标签内文章按新→旧排列
8
- export async function getStaticPaths() {
9
- const all = await getCollection("posts", ({ data }) =>
10
- import.meta.env.PROD ? !data.draft : true,
11
- );
12
- const sorted = getSortedPosts(all);
13
- return [...collectTags(sorted).entries()].map(([tag, posts]) => ({
14
- params: { tag },
15
- props: { tag, posts },
16
- }));
17
- }
18
-
19
- const { tag, posts } = Astro.props;
20
- ---
21
-
22
- <BaseLayout title={t('tagTitle', { tag })} page="tags">
23
- <header class="archive-head reveal">
24
- <h1 class="page-title">{tag}</h1>
25
- <p class="page-sub">{t('totalPosts', { n: posts.length })}</p>
26
- </header>
27
- <div class="tag-list">
28
- {
29
- posts.map((post) => (
30
- <a class="related-card card tag-item reveal" href={`/posts/${post.id}/`}>
31
- <div class="rc-title">{post.data.title}</div>
32
- <div class="rc-meta">
33
- {formatDate(post.data.published)}
34
- {post.data.category ? ` · ${post.data.category}` : ''}
35
- </div>
36
- </a>
37
- ))
38
- }
39
- </div>
40
- </BaseLayout>