From 4f18f1bc6293d5f90e411c2cbc216b9eadf5bdf9 Mon Sep 17 00:00:00 2001 From: Corwin Date: Sun, 12 May 2024 15:41:31 +0100 Subject: [PATCH] remove special characters in sluggification --- website/agb/src/app/tapir/dpl/page.tsx | 2 +- website/agb/src/sluggify.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/website/agb/src/app/tapir/dpl/page.tsx b/website/agb/src/app/tapir/dpl/page.tsx index eb136415..9109487e 100644 --- a/website/agb/src/app/tapir/dpl/page.tsx +++ b/website/agb/src/app/tapir/dpl/page.tsx @@ -6,7 +6,7 @@ export const metadata: Metadata = { title: "Dungeon Puzzler Redirect", }; -const REDIRECT_TO = "/showcase/the-dungeon-puzzler's-lament"; +const REDIRECT_TO = "/showcase/the-dungeon-puzzlers-lament"; export default function DplRedirectPage() { redirect(REDIRECT_TO); diff --git a/website/agb/src/sluggify.ts b/website/agb/src/sluggify.ts index b02353b9..aa94e3de 100644 --- a/website/agb/src/sluggify.ts +++ b/website/agb/src/sluggify.ts @@ -1,3 +1,7 @@ export function slugify(x: string) { - return x.toLowerCase().split(" ").join("-"); + return x + .toLowerCase() + .split(" ") + .join("-") + .replace(/[^a-zA-Z0-9\-]/, ""); }