Documentation
¶
Overview ¶
Package slugify implements URL Slug Pattern
s := "Brad's Deals & Shopsmart" fmt.Println(slugify.Slugify(s)) // Output: brads-deals-shopsmart
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ReInValidChar = regexp.MustCompile(fmt.Sprint("[^a-zA-Z0-9]+"))
ReInValidChar match invalid slug string
View Source
var Separator = "-"
Separator separator between words
View Source
var StripChar = regexp.MustCompile(fmt.Sprint("['\"`]", ""))
StripChar removes invalid slug characters
Functions ¶
func Slugify ¶
Slugify implements make a pretty slug from the given text. e.g. Slugify("kožušček hello world") => "kozuscek-hello-world"
Example ¶
package main
import (
"fmt"
"github.com/shopsmart/go-slugify"
)
func main() {
s := "Nín hǎo. Wǒ shì zhōng guó rén This is a test, Brad's Deals ---"
fmt.Println(slugify.Slugify(s))
}
Output: nin-hao-wo-shi-zhong-guo-ren-this-is-a-test-brads-deals
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.