Skip to content
/ slug Public
forked from gosimple/slug

URL-friendly slugify with multiple languages support.

License

Notifications You must be signed in to change notification settings

sidmal/slug

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slug

This is fork of slug package.

This is fork has had a few improvements from the original slug package such as:

  • Added new private constants to setting of default language and word separator of slug
  • Extended MakeLang function. Now you can set word separator of slug as parameter of function
  • Extended body of Make function for comply new descriptor of MakeLag function

Package slug generate slug from unicode string, URL-friendly slugify with multiple languages support.

Example

package main

import (
	"fmt"
	"github.com/sidmal/slug"
)

func main() {
	text := slug.Make("Hellö Wörld хелло ворлд")
	fmt.Println(text) // Will print: "hello_world_khello_vorld"

	enText := slug.MakeLang("This & that", "en", "*")
	fmt.Println(enText) // Will print: "this*and*that"

	slug.CustomSub = map[string]string{
		"water": "sand",
	}
	textSub := slug.Make("water is hot")
	fmt.Println(textSub) // Will print: "sand-is-hot"
}

How install

go get -u github.com/sidmal/slug

License

License to original package you can find by this link

About

URL-friendly slugify with multiple languages support.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%