1. cliveportman
  2. /code
  3. /strip-http-and-https-from-urls-natively-using-twig

Strip http:// and https:// from URLs natively using Twig

Don't like those pesky protocols trashing your oh-so-beautiful design? So, so good using Twig's replace filter:

<a href="{{ venue.venueUrl }}">
    {{ venue.venueUrl | replace({'http://': '', 'https://': ''}) }}

Quite why I was pissing about with the trim filter I've no idea, though it isn't obvious from the docs.