mirror of
https://github.com/saicaca/fuwari.git
synced 2026-01-11 23:02:53 +01:00
refactor: improve code quality
This commit is contained in:
@@ -12,13 +12,11 @@ function joinUrl(...parts: string[]): string {
|
||||
return joined.replace(/\/+/g, '/');
|
||||
}
|
||||
|
||||
export function getPostUrlBySlug(slug: string): string | null {
|
||||
if (!slug) return null
|
||||
export function getPostUrlBySlug(slug: string): string {
|
||||
return url(`/posts/${slug}/`)
|
||||
}
|
||||
|
||||
export function getCategoryUrl(category: string): string | null {
|
||||
if (!category) return null
|
||||
export function getCategoryUrl(category: string): string {
|
||||
if (category === i18n(i18nKey.uncategorized))
|
||||
return url('/archive/category/uncategorized/')
|
||||
return url(`/archive/category/${category}/`)
|
||||
|
||||
Reference in New Issue
Block a user