Overview
Generate URL-safe slugs from strings. Use for blog posts, product URLs, etc.
Features
- Unicode normalization
- Special character removal
- Configurable separator
- Unique slug generation
Installation
npx hanma add slug
Dependencies
slugify
Code
// Source code not available
Usage
import { generateSlug, uniqueSlug } from './utils/slug';
const slug = generateSlug('Hello World!'); // 'hello-world'
Dependencies
slugify
Frequently Asked Questions
How do I install Slug Generator?
Run the following command:
npx hanma add slugWhat dependencies are required?
This snippet requires: slugify. Make sure to install them before using the snippet.
How do I use this snippet?
Copy the code and paste it into your project. The snippet will be saved to
utils/slug.ts.Can I customize this snippet?
Yes! All snippets are copy-paste code that you own. Feel free to modify them to fit your needs.
Does this work with other frameworks?
This snippet is designed for the specific framework. Check the other framework pages for equivalent implementations.