feat: add license block

This commit is contained in:
saicaca
2023-11-03 14:10:54 +08:00
parent a20c647495
commit c642691dc8
13 changed files with 111 additions and 8 deletions

View File

@@ -1,9 +1,16 @@
import {siteConfig} from "../config.ts";
export function pathsEqual(path1: string, path2: string) {
const normalizedPath1 = path1.replace(/^\/|\/$/g, '').toLowerCase();
const normalizedPath2 = path2.replace(/^\/|\/$/g, '').toLowerCase();
return normalizedPath1 === normalizedPath2;
}
function joinUrl(...parts: string[]): string {
const joined = parts.join('/');
return joined.replace(/([^:]\/)\/+/g, '$1');
}
export function getPostUrlBySlug(slug: string): string | null {
if (!slug)
return null;
@@ -16,3 +23,6 @@ export function getCategoryUrl(category: string): string | null {
return `/archive/category/${category}`;
}
export function getFullUrl(path: string): string {
return joinUrl(siteConfig.url, path);
}