Technical

Slug

A slug is the human-readable, URL-friendly portion of a web address that identifies a specific page, typically derived from the page title using lowercase letters, numbers, and hyphens.

The slug is the last segment of a clean URL — in `/glossary/meta-description`, the slug is `meta-description`. Good slugs are concise, descriptive, and include relevant keywords. They help both users and search engines understand what the page is about before visiting it.

Slug best practices: derive from the page title but keep it shorter, use only lowercase letters and hyphens, remove stop words ("a", "the", "and") when they add no meaning, and never change a slug after publication without setting up a 301 redirect.

In Next.js dynamic routes, the slug comes from the URL parameter: `app/glossary/[slug]/page.tsx`. Generate slugs consistently using a helper function that lowercases, removes special characters, and replaces spaces with hyphens.

Example

// Slug generation utility
function generateSlug(title: string): string {
  return title
    .toLowerCase()
    .replace(/[^a-z0-9\s-]/g, "")
    .replace(/\s+/g, "-")
    .replace(/-+/g, "-")
    .trim();
}

// "Core Web Vitals" → "core-web-vitals"
// "What is E-E-A-T?" → "what-is-e-e-a-t"

Stop shipping broken SEO

Indxel validates your metadata, guards your CI/CD pipeline, and monitors indexation — so you never miss an SEO issue again.