Convert 'widget_data' text value to a hyphenated text value with hubL
SOLVE
I'm looking to take a value that could be a string of words (i.e. 'A Partner Name') and first, convert it to lower case and then to join the words with hyphens.
Is this possible with hubL? As far as I can tell, the only supported method is to lowercase, but not to string them.
Desired output example:
{% text "partner_name" label="Partner Name", export_to_template_context=True %}
<img class="{{ widget_data.partner_name.value }}">
partner_name = A Partner Name
<img class = "a-partner-name">
Convert 'widget_data' text value to a hyphenated text value with hubL
SOLVE
Ideally, HubSpot would have a "slugify" HubL filter. However, adding to @ndwilliams3 reply, you can also combine multiple "replace" filters on top of each other to mimic the slugify behavior. E.g.: