How to Format a Phone Number in HubSpot CMS HubL

Get a Free HubSpot CMS Guide
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] }}


Related resources

  • HubSpot CMS vs WordPress: Feature Comparison and Review
  • 25+ Questions to Ask Before Redesigning Your Business Website
  • 5 Things A Business Should Consider Before a Website Redesign
  • How to Get a Responsive Website for Your Manufacturing Company
  • What Is a Good WordPress Alternative for Businesses?

  • Related posts


    Want to Get Email Updates of New Posts? Join My Email Newsletter