slugify-url-smart
v1.0.2
Published
A zero-dependency, smart URL slug generator with transliteration and emoji support.
Maintainers
Readme
🔗 slugify-url-smart
A zero-dependency, smart URL slug generator with emoji support (🔥 → fire), transliteration (café → cafe), and SEO-friendly output. Perfect for blogs, e-commerce, and CMS platforms.
✨ Features
- 🎯 Emoji to Text: Converts
🚀→rocket,❤️→heart, etc. - 🌍 Unicode Aware: Handles accents (e.g.,
München→muenchen). - 🔧 Flexible Formats: Choose
kebab-case,snake_case, orcamelCase. - 🧹 Clean Output: Strips special chars, spaces, and duplicates.
- 📦 Zero Dependencies – Lightweight (≈2KB) and fast.
🚀 Install
npm install slugify-url-smart
# or
yarn add slugify-url-smart
# or
pnpm add slugify-url-smart📖 Usage
Basic (kebab-case)
import { slugify } from 'slugify-url-smart';
slugify('🔥 Hot Deals! Café 50% OFF → 2024');
// Output: 'fire-hot-deals-cafe-50-percent-off-2024'Custom Format (snake_case/camelCase)
slugify('Hello World 🌎', { case: 'snake' });
// Output: 'hello_world_earth'
slugify('Hello World 🌎', { case: 'camel' });
// Output: 'helloWorldEarth'⚙️ API
slugify(input: string, options?)
input: String to convert (e.g.,"Hello @World!").options.case:'kebab'(default),'snake', or'camel'.
🛠 Use Cases
- Blogs: Clean post URLs (
/fire-hot-deals-2024). - E-commerce: Product slugs (
/organic-cafe-latte). - CMS: Safe paths for user-generated content.
- SEO: Readable URLs for better rankings.
❓ FAQ
Q: Does it handle non-Latin scripts?
A: Yes! Transliterates Cyrillic, Chinese, etc. (e.g., 北京 → bei-jing).
Q: Can I contribute?
A: Absolutely! Open an issue or PR on GitHub.
📜 License
MIT © Ronak Munjapara
Like this? ⭐️ Star the repo!
Key Improvements:
- Visual Hierarchy: Clear sections with emojis and dividers.
- Badges: Added npm version, license, size, and CI status for credibility.
- FAQ: Anticipates common questions.
- Install Options: Shows
npm/yarn/pnpmcommands. - Call-to-Action: Encourages GitHub stars.
