How to Format a Phone Number in HubSpot CMS HubL


How to Format a Phone Number in HubSpot CMS HubL

I was recently working on a custom HubSpot quote theme and needed to format the phone number. By default, the number was displayed as a long string of numbers without any parenthesis or number groupings. The code below uses a HubL to display a subset of the full string in the chunks you need it to appear.

<a href="tel:{{ quote.hs_sender_phone }}">
+{{ quote.hs_sender_phone[:1] }}({{ quote.hs_sender_phone[1:4] }}) {{ quote.hs_sender_phone[4:7] }}-{{ quote.hs_sender_phone[7:11] }}
</a>

 


Written by: Jake Lett
Jake Lett is a results-driven B2B marketing consultant with 15+ years of experience helping businesses boost online visibility, generate qualified leads, and increase sales. Specializing in SEO, HubSpot, and PPC campaign management, Jake leverages proven strategies to deliver measurable growth. As a Certified Google Ads Specialist and HubSpot Developer, he is committed to driving impactful results for his clients.

Related posts

Tags:

Want to Get Email Updates of New Articles?

Join My Email Newsletter