The url_domain filter parses the URL and returns the domain portion of the URL if it exists.

If a domain portion of the URL cannot be found then the original value is returned.

This filter can be useful if you have an app item that has a website value and you want to output a link. The website value is often unknown and can sometimes be long. Instead of defaulting to some generic text for the link (like "Website") you can instead show the domain name as the link.

<a href="{{ item.website|url }}">{{ item.website|url_domain }}</a>

< Back to the list of filters