devkits-slugify
v1.0.3
Published
Generate SEO-friendly URL slugs from text — clean, fast, zero dependencies
Downloads
366
Maintainers
Readme
devkits-slugify
Generate SEO-friendly URL slugs from text. Clean, fast, zero dependencies.
Install
npm install -g devkits-slugifyUsage
CLI
# Basic slugify
slugify "Hello World!"
# Output: hello-world
# Custom separator
slugify "My Blog Post" -s "_"
# Output: my_blog_post
# Max length
slugify "Very Long Title Here" -m 15
# Output: very-long-titl
# Disable lowercase
slugify "Hello World" -l false
# Output: Hello-WorldProgrammatic API
const { slugify } = require('devkits-slugify');
slugify("Hello World!"); // 'hello-world'
slugify("My Blog Post", { separator: '_' }); // 'my_blog_post'
slugify("Long Title", { maxLength: 10 }); // 'long-title'
slugify("Héllo Wörld"); // 'hello-world' (transliteration)Options
| Option | Alias | Default | Description |
|--------|-------|---------|-------------|
| --separator | -s | - | Separator character |
| --lowercase | -l | true | Convert to lowercase |
| --max-length | -m | 0 | Maximum length (0 = unlimited) |
Features
- Transliteration — Converts accented characters (é → e, ü → u, ß → ss)
- Custom separators — Use hyphens, underscores, dots, or any character
- Max length — Truncate slugs for URL length requirements
- Zero dependencies — Pure JavaScript, no external packages
- RFC 3986 compliant — Produces URL-safe strings
Related Tools
🔍 Build something amazing? Check out API Monitor — simple, affordable API monitoring for indie hackers. Get alerted before your customers notice. Just $9/mo.
See Also
- DevKits — All 82 free developer tools in one place
- JSON Formatter — Format and validate JSON
- Base64 Encoder — Encode/decode Base64
- JWT Decoder — Decode JWT tokens
- UUID Generator — Generate UUIDs
- Hash Generator — Create MD5, SHA1, SHA256 hashes
- CSS Tools — CSS minifier, formatter, validator
- HTML Tools — HTML formatter, minifier
- URL Tools — URL encode/decode, parse
- Color Converter — Convert HEX, RGB, HSL colors
- Regex Tester — Test and debug regular expressions
Support DevKits
If you find this tool useful, please consider supporting the project:
Open Collective
Become a sponsor: Open Collective - DevKits
Crypto Donations
Prefer crypto? We accept:
- ETH (Ethereum):
0xDea4a6A20fCB44467e45Ef378972F54B22dC59db - USDC (ERC-20):
0xDea4a6A20fCB44467e45Ef378972F54B22dC59db
Donation Perks:
- $5+ — Supporter Badge
- $10+ — Pro Access (1 month)
- $29+ — Pro Access (1 year)
- $100+ — Lifetime Pro + Priority Support
After donating, email your transaction hash to [email protected] to claim perks.
License
MIT — DevKits Team
