For the complete documentation index, see llms.txt. This page is also available as Markdown.

Slugify

Slugify a string for URL safety

Method Signature

Slugify(string=[string], maxLength=[integer], allow=[string])

Arguments

Argument
Type
Required
Description
Default

string

string

true

The target string

maxLength

integer

false

The maximum number of chracters to allow, 0 is all

0

allow

string

false

A regex safe list of additional characters to allow. The default is [^a-z0-9]

Examples

Convert a string to a URL-friendly slug

result = slugify( "Hello World! This is a Test." );
writeOutput( result );

Result: hello-world-this-is-a-test

Handle special characters

Result: cafe-restaurant-new-york

Using the member function

Result: my-blog-post-title

Last updated

Was this helpful?