9c7c2f1163
* seo friendly urls * custom client serve-static module * database fixes * fix recent pages * other fixes
16 lines
335 B
TypeScript
16 lines
335 B
TypeScript
import slugify from "@sindresorhus/slugify";
|
|
|
|
export const buildPageSlug = (
|
|
pageShortId: string,
|
|
pageTitle?: string,
|
|
): string => {
|
|
const titleSlug = slugify(pageTitle?.substring(0, 99) || "untitled", {
|
|
customReplacements: [
|
|
["♥", ""],
|
|
["🦄", ""],
|
|
],
|
|
});
|
|
|
|
return `/p/${pageShortId}/${titleSlug}`;
|
|
};
|