Skip to content

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.

Notifications You must be signed in to change notification settings

ronakmunjapara/slugify-url-smart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔗 slugify-url-smart

npm version License: MIT Bundle Size CI Status

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ünchenmuenchen).
  • 🔧 Flexible Formats: Choose kebab-case, snake_case, or camelCase.
  • 🧹 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!


About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published