2023-09-26 14:27:38 +08:00
|
|
|
export function pathsEqual(path1: string, path2: string) {
|
|
|
|
|
const normalizedPath1 = path1.replace(/^\/|\/$/g, '').toLowerCase();
|
|
|
|
|
const normalizedPath2 = path2.replace(/^\/|\/$/g, '').toLowerCase();
|
|
|
|
|
return normalizedPath1 === normalizedPath2;
|
|
|
|
|
}
|
2023-10-11 22:29:23 +08:00
|
|
|
|
|
|
|
|
export function getPostUrlBySlug(slug: string): string | null {
|
|
|
|
|
if (!slug)
|
|
|
|
|
return null;
|
|
|
|
|
return `/posts/${slug}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getCategoryUrl(category: string): string | null {
|
|
|
|
|
if (!category)
|
|
|
|
|
return null;
|
|
|
|
|
return `/archive/category/${category}`;
|
|
|
|
|
}
|
|
|
|
|
|