Skip to main content

DefaultSlugStrategy

The default strategy for generating slugs. This strategy:

  • Converts to lowercase
  • Replaces spaces and special characters with hyphens
  • Removes non-alphanumeric characters (except hyphens)
  • Removes leading and trailing hyphens
  • Collapses multiple hyphens into one

Example

Ts
Signature

generate

method(ctx: RequestContext, params: SlugGenerateParams) => string
Was this chapter helpful?
Report Issue
Edited Feb 25, 2026·Edit this page