Skip to content

getUrl()

The getUrl method is used to get the URL of the current page. Object type depends on the context of current page.

If the url does not exist, the method returns null.

Example

For "promotions" context:

source
{% set url = ObjectApi.getUrl() %}
{{ url.relative }}
output
/pl/promotions

For "new products" context:

source
{% set url = ObjectApi.getUrl() %}
{{ url.relative }}
output
/pl/new