diff --git a/frontmatter.json b/frontmatter.json index a377ad99e..ac17e0af8 100644 --- a/frontmatter.json +++ b/frontmatter.json @@ -46,11 +46,6 @@ "name": "tags", "type": "list" }, - { - "title": "category", - "name": "category", - "type": "string" - }, { "title": "draft", "name": "draft", diff --git a/scripts/new-post.js b/scripts/new-post.js index 187bfd0e7..9e99e7dc4 100644 --- a/scripts/new-post.js +++ b/scripts/new-post.js @@ -51,7 +51,7 @@ published: ${getDate()} description: '' image: '' tags: [] -category: '' + draft: false lang: '' --- diff --git a/src/components/ArchivePanel.astro b/src/components/ArchivePanel.astro index 24159c8c5..0fb37d498 100644 --- a/src/components/ArchivePanel.astro +++ b/src/components/ArchivePanel.astro @@ -1,16 +1,13 @@ --- -import { UNCATEGORIZED } from "@constants/constants"; -import I18nKey from "../i18n/i18nKey"; -import { i18n } from "../i18n/translation"; + import { getSortedPosts } from "../utils/content-utils"; import { getPostUrlBySlug } from "../utils/url-utils"; interface Props { keyword?: string; tags?: string[]; - categories?: string[]; } -const { tags, categories } = Astro.props; +const { tags } = Astro.props; let posts = await getSortedPosts(); @@ -22,13 +19,7 @@ if (Array.isArray(tags) && tags.length > 0) { ); } -if (Array.isArray(categories) && categories.length > 0) { - posts = posts.filter( - (post) => - (post.data.category && categories.includes(post.data.category)) || - (!post.data.category && categories.includes(UNCATEGORIZED)), - ); -} + const groups: { year: number; posts: typeof posts }[] = (() => { const groupedPosts = posts.reduce( @@ -74,7 +65,7 @@ function formatTag(tag: string[]) {
-
{group.posts.length} {i18n(I18nKey.postsCount)}
+
{group.posts.length} 篇文章
{group.posts.map(post => ( import type { LIGHT_DARK_MODE } from "@/types/config.ts"; import { AUTO_MODE, DARK_MODE, LIGHT_MODE } from "@constants/constants.ts"; -import I18nKey from "@i18n/i18nKey"; -import { i18n } from "@i18n/translation"; + import Icon from "@iconify/svelte"; import { applyThemeToDocument, @@ -78,21 +77,21 @@ function hidePanel() { onclick={() => switchScheme(LIGHT_MODE)} > - {i18n(I18nKey.lightMode)} + 浅色模式 diff --git a/src/components/PostCard.astro b/src/components/PostCard.astro index 56ed8c046..fdcfa053e 100644 --- a/src/components/PostCard.astro +++ b/src/components/PostCard.astro @@ -2,8 +2,7 @@ import path from "node:path"; import type { CollectionEntry } from "astro:content"; import { Icon } from "astro-icon/components"; -import I18nKey from "../i18n/i18nKey"; -import { i18n } from "../i18n/translation"; + import { getDir } from "../utils/url-utils"; import PostMetadata from "./PostMeta.astro"; import ImageWrapper from "./misc/ImageWrapper.astro"; @@ -17,7 +16,6 @@ interface Props { published: Date; updated?: Date; tags: string[]; - category: string; image: string; description: string; draft: boolean; @@ -30,7 +28,6 @@ const { published, updated, tags, - category, image, description, style, @@ -65,7 +62,7 @@ const { remarkPluginFrontmatter } = await entry.render(); - +
@@ -74,9 +71,9 @@ const { remarkPluginFrontmatter } = await entry.render();
-
{remarkPluginFrontmatter.words} {" " + i18n(I18nKey.wordsCount)}
+
{remarkPluginFrontmatter.words} 字
|
-
{remarkPluginFrontmatter.minutes} {" " + i18n(I18nKey.minutesCount)}
+
{remarkPluginFrontmatter.minutes} 分钟
|
加载中... diff --git a/src/components/PostMeta.astro b/src/components/PostMeta.astro index 2e8070e16..f785fd3bd 100644 --- a/src/components/PostMeta.astro +++ b/src/components/PostMeta.astro @@ -1,7 +1,6 @@ --- import { Icon } from "astro-icon/components"; -import I18nKey from "../i18n/i18nKey"; -import { i18n } from "../i18n/translation"; + import { getDir, url } from "../utils/url-utils"; import { formatDateToYYYYMMDD } from "../utils/date-utils"; import { umamiConfig } from "../config"; @@ -11,7 +10,6 @@ interface Props { published: Date; updated?: Date; tags: string[]; - category: string; hideTagsForMobile?: boolean; hideUpdateDate?: boolean; slug?: string; @@ -20,7 +18,6 @@ const { published, updated, tags, - category, hideTagsForMobile = false, hideUpdateDate = false, slug, @@ -49,21 +46,6 @@ const className = Astro.props.class;
)} - - -
))} - {!(tags && tags.length > 0) &&
{i18n(I18nKey.noTags)}
} + {!(tags && tags.length > 0) &&
无标签
}
diff --git a/src/components/PostPage.astro b/src/components/PostPage.astro index 4e46ed462..4fdf8c8d8 100644 --- a/src/components/PostPage.astro +++ b/src/components/PostPage.astro @@ -14,7 +14,6 @@ const interval = 50; entry={entry} title={entry.data.title} tags={entry.data.tags} - category={entry.data.category} published={entry.data.published} updated={entry.data.updated} url={getPostUrlBySlug(entry.slug)} diff --git a/src/components/Search.svelte b/src/components/Search.svelte index 701b5df3e..e3e2214c3 100644 --- a/src/components/Search.svelte +++ b/src/components/Search.svelte @@ -1,6 +1,5 @@