A Go library for generating URL-friendly slugs from Unicode strings with multi-language support.
Slug is a Go library that converts Unicode strings into URL-friendly slugs. It solves the problem of creating safe, readable identifiers from text in multiple languages by transliterating characters to ASCII and removing unsafe characters. This is essential for generating SEO-friendly URLs, filenames, and other identifiers in web applications.
Go developers building web applications, content management systems, or any software requiring clean, URL-safe strings from user input in various languages.
Developers choose Slug for its robust multi-language support, safety guarantees, and customization options. It provides a simple, reliable way to generate slugs without worrying about encoding issues or unsafe characters.
URL-friendly slugify with multiple languages support.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Handles Unicode from languages like German and Chinese, converting characters to ASCII equivalents as shown with 'Hellö Wörld' becoming 'hello-world-khello-vorld'.
Ensures slugs contain only alphanumeric characters, hyphens, and underscores with no leading/trailing separators, making them URL and filename safe as specified in the design.
Allows custom word replacements via the CustomSub map, enabling domain-specific adjustments like changing 'water' to 'sand' in slugs.
Provides flexibility by setting Lowercase to false to preserve uppercase characters, useful for slugs where case matters, such as in the German example.
Relies on the external unidecode library for transliteration, which can introduce maintenance overhead and potential inaccuracies for some language mappings.
Transliteration is context-insensitive, meaning it may not handle language nuances or homographs perfectly, requiring manual fixes for edge cases.
Adding new language support or character substitutions requires editing source files like languages_substitution.go, which isn't dynamic or user-friendly for runtime changes.