I’m working on a HubSpot template and need help with transforming text strings into URL-friendly formats using HubL.
Basically, I want to take regular text like Sample Content and turn it into sample-content (lowercase with hyphens instead of spaces). I need this functionality to create dynamic CSS class names based on user input from module fields.
I’m familiar with WordPress where you can use sanitize_title() for this purpose, but I can’t find a similar built-in filter in HubL. Since HubL runs on Python, I’m wondering if there are any Python string methods that work within HubL templates.
Has anyone managed to implement this kind of text slugification in HubSpot? Any suggestions or code examples would be really helpful.