

ts-slug
A powerful TypeScript library for converting text strings into URL-friendly slugs. Whether you're building a blog, CMS, or any application that needs clean, normalized URLs, ts-slug
provides a robust solution with excellent multilingual support.
Features
ts-slug
offers a range of powerful features:
- 🌍 Unicode Support - Handles special characters from any language
- 🔤 Locale-specific Handling - Special support for German, Bulgarian, Serbian, Ukrainian, and more
- ⚙️ Highly Configurable - Customize replacement characters, case sensitivity, and more
- 🔄 Multiple Modes - Choose between RFC 3986 compliant or pretty URL formats
- 📝 TypeScript Native - Full type definitions included
- 🪶 Zero Dependencies - Lightweight with no external dependencies
- 🧪 Thoroughly Tested - Comprehensive test suite ensures reliability
Quick Example
import slug from 'ts-slug'
slug('Hello World')
slug('Hello World', {
replacement: '_',
lower: false
})
slug('こんにちは世界')
slug('Schöne Grüße', { locale: 'de' })
Installation
npm install ts-slug
yarn add ts-slug
pnpm add ts-slug
bun install ts-slug
Testing
bun test
Changelog
Please see our releases page for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
Discussions on GitHub
For casual chit-chat with others using this package:
Join the Stacks Discord Server
Postcardware
"Software that is free, but hopes for a postcard." We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.
Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
Credits
We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
License
The MIT License (MIT). Please see LICENSE for more information.
Made with 💙