Skip to content

Instantly share code, notes, and snippets.

@piotrpog piotrpog/phone_number.twig
Last active Jun 21, 2019

What would you like to do?
Phone number macro - this macro strips unnesesary haracters from phone numbers and generates "phone links.
{% macro phoneNumber(phoneNumber) %}
<a href="tel:{{ phoneNumber|replace({'-':'', ' ':'', '.':'', '(':'', ')':''}) }}">{{ phoneNumber }}</a>
{% endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.