Marten::Core::Sluggable
The Sluggable module provides functionality for generating URL-friendly slugs from strings.
Instance methods
generate_slug(value, max_size)
Generates a slug from the given value, ensuring the resulting slug does not exceed the specified max_size.
The slug is created by:
- Removing non-alphanumeric characters (except for Unicode letters, numbers, symbols, whitespace, and hyphens).
- Converting the string to lowercase.
- Replacing sequences of whitespace and hyphens with a single hyphen.
- Stripping trailing hyphens and underscores from the slug.
- Truncating the slug to the specified max_size.