feat: make 'uncategorized' a category

This commit is contained in:
saicaca
2024-01-21 20:21:04 +08:00
parent 23533e9ac9
commit e0b93eb63c
5 changed files with 20 additions and 13 deletions

View File

@@ -1,3 +1,6 @@
import {i18n} from "@i18n/translation.ts";
import i18nKey from "@i18n/i18nKey.ts";
export function pathsEqual(path1: string, path2: string) {
const normalizedPath1 = path1.replace(/^\/|\/$/g, '').toLowerCase()
const normalizedPath2 = path2.replace(/^\/|\/$/g, '').toLowerCase()
@@ -15,7 +18,10 @@ export function getPostUrlBySlug(slug: string): string | null {
}
export function getCategoryUrl(category: string): string | null {
if (!category) return null
if (!category)
return null
if (category === i18n(i18nKey.uncategorized))
return '/archive/category/uncategorized'
return `/archive/category/${category}`
}