Fix slug logic

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-07-14 12:38:07 +02:00
parent e9d5f86ea2
commit 5e145a9086

View File

@@ -20,14 +20,16 @@ import (
)
var (
regHyphens = regexp.MustCompile("-+")
regSpaces = regexp.MustCompile(" ")
regLower = regexp.MustCompile("[^a-z0-9-]")
regHyphens = regexp.MustCompile("-+")
regSpaces = regexp.MustCompile(" ")
regUnderscores = regexp.MustCompile("_")
regLower = regexp.MustCompile("[^a-z0-9-]")
)
func Make(s string) string {
s = strings.ToLower(s)
s = regSpaces.ReplaceAllString(s, "-")
s = regUnderscores.ReplaceAllString(s, "-")
s = regLower.ReplaceAllString(s, "")
s = regHyphens.ReplaceAllString(s, "-")
s = strings.Trim(s, "-")