🔗

Slug (URL)

A slug is the final part of a URL that identifies a resource in readable form: lowercase text, no accents or spaces, with words separated by hyphens. Example: 'what-is-a-url-slug'.

Examples

  • "What is CSS Grid?" → "what-is-css-grid"
  • "10 Tips to Improve SEO" → "10-tips-improve-seo"
  • "Coffee with Milk & Sugar" → "coffee-with-milk-sugar"
  • "React v18: New Features" → "react-v18-new-features"
  • "User: John@Doe" → "user-johndoe"

FAQ

Should I use hyphens or underscores in slugs?

Always hyphens (-), never underscores (_). Google treats hyphens as word separators (hello-world = "hello world") but underscores as part of a word (hello_world = "helloworld"). This affects how it indexes keywords. Hyphens have been the universal web standard for 20 years.

Can I include numbers in a slug?

Yes, numbers are valid and useful: "react-18", "top-10-tools", "guide-2024". They're kept as-is, without conversion. Avoid only numbers ("12345") because they're not descriptive, but numbers within descriptive text are perfect and can improve CTR in searches (people click on numbered lists).

What do I do if two titles generate the same slug?

Add a numeric suffix or discriminator. If "CSS Guide" generates "css-guide" and it already exists, the next can be "css-guide-2" or "css-guide-advanced". Some CMS add IDs automatically: "css-guide-a8f3". The important thing is each slug is unique in your system. Never allow duplicates, breaks routing.