is_site_url

Test if the given URL is a url for the current site.

If the current site handles requests for the hostname example.com, then all of the following expressions will echo true:

{{ "https://example.com"|is_site_url }}
{{ "#foo"|is_site_url }}
{{ "/page/path"|is_site_url }}
{{ "//example.com"|is_site_url }}

The following will echo false:

{{ "https://foo.test"|is_site_url }}
{{ "example.com"|is_site_url }}
{{ "//foo.test"|is_site_url }}

Edit on GitHub

URLs and links url

Referred by

Filters

Filters transform template variables before they are rendered.