How to Format a Phone Number in HubSpot CMS HubL

Get FREE HubSpot Tutorial for Beginners PDF
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
I share digital marketing tips and HubSpot tutorials to help marketers and business owners grow their business.

Related posts

Tags:

Want to Get Email Updates of New Articles?

Join My Email Newsletter