Give us feedback
Service icon


Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded on 18 Oct by 
 (0 ratings)


Text convert to a slug. For example: input: Test%Test nº 1997 Slug: test-test-no-1997
Read more

This code provides a utility for generating slugs from text input within OutSystems applications. Slugs are typically used in URLs to create user-friendly and SEO-friendly web addresses.

The GenerateSlug function performs the following tasks:

  1. It takes a string as input and converts it into a slug format, which typically consists of lowercase characters, hyphens to replace spaces, and the removal of special characters.

  2. It uses the Unidecode function to transliterate any accented or non-ASCII characters to their closest ASCII equivalents. For example, it replaces characters like "é" with "e" and "ç" with "c."

  3. If the input string contains the character "º" (the degree symbol), it replaces it with "o" to ensure that it is handled correctly. This is particularly useful for cases where the degree symbol may be used instead of the letter "o."

  4. It removes any remaining special characters, except for hyphens, spaces, and tildes, using regular expressions.

  5. It replaces consecutive spaces with hyphens and removes any duplicated hyphens to ensure the resulting slug is clean and readable.

  6. Finally, it converts the slug to lowercase.

This code is designed to improve the handling of special characters and provide more consistent slugs for URLs in OutSystems applications.

Release notes (1.0.0)
License (1.0.0)
Reviews (0)