slug is a Go library for generating URL-friendly slugs.
Before and after:
A Lovely Day
→a-lovely-day
Living in 北京
→living-in-bei-jing
package main
import "github.com/peferron/slug"
func main() {
s := slug.Generate("Hello World")
print(s) // Prints "hello-world"
}
See the full API reference.