This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Twig URL parser: #} | |
{% set url= 'http://subdomain.domain.tld/some/dir/file.pdf' %} | |
{% set noprotocol = url|split('//')[1] ?: url %} | |
{% set domains = noprotocol|split('/')[0] ?: noprotocol %} | |
{% if domains|split('.')[2] is defined %} | |
{% set subdomain = domains|split('.')[0] %} | |
{% set domain = domains|split('.')[1] %} | |
{% set tld = domains|split('.')[2] %} | |
{% else %} | |
{% set subdomain = '' %} |