cleanup slug formatting

This commit is contained in:
2023-08-14 10:06:08 +10:00
parent a369db9ca1
commit 60a15c2227

View File

@@ -119,7 +119,8 @@ const updateSlug = async () => {
let idx = 0;
let pre_slug = (form.controls.title.value as string)
.toLowerCase()
.replace(/[^a-z0-9]/gim, "-")
.replace(/[^a-z0-9 ]/gim, "")
.replace(/ +/g, "-")
.replace(/-+/g, "-")
.replace(/^-*(.+?)-*$/, "$1");