The dashcase helper converts a string to dash-case by replacing spaces, underscores, and other non-word characters with hyphens and lowercasing the result. Use it to generate URL slugs, file names, or API identifiers that require a consistent hyphenated format.
Syntax
{{dashcase value}}
value -- The string to convert. Required. Non-string inputs (numbers, booleans) are converted to strings before processing. Arrays of primitive values are converted to a comma-separated string before processing. Objects and object arrays produce unusable output.
Examples
Convert a mixed-separator string
{{dashcase record.product.name}}
Input:
{ "record": { "product": { "name": "a-b-c d_e" } } }
Output: a-b-c-d-e
Existing hyphens, spaces, and underscores are all normalized to a single -.
Convert a space-separated string to a slug
{{dashcase record.category}}
Input:
{ "record": { "category": "New Product Launch 2025" } }
Output: new-product-launch-2025
Split at camelCase boundaries
{{dashcase record.camel}}
Input:
{ "record": { "camel": "getUserProfile" } }
Output: get-user-profile
The helper inserts hyphens at camelCase and PascalCase word boundaries.
Usage notes
- All word separators (spaces, underscores, dashes, and other non-word characters) are normalized to a single
-. - Multiple consecutive separators are collapsed into a single hyphen.
- Leading and trailing hyphens are trimmed. An input made entirely of separators returns an empty string.
- The output is always lowercased.
- Hyphens are inserted at camelCase and PascalCase boundaries.
- Digits stay with the surrounding word.
{{dashcase "version-2_1-final"}}returnsversion-2-1-final. - Do not pass objects or object arrays -- the output will be unusable.