Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions reference/twig_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,38 @@ Returns the absolute URL (with scheme and host) for the given route. If
``schemeRelative`` is enabled, it'll create a scheme-relative URL. More
information in :ref:`book-templating-pages`.

absolute_url
~~~~~~~~~~~~

.. code-block:: jinja

{{ absolute_url(path) }}

``path``
**type**: ``string``

Returns the absolute URL for the given absolute path. This is useful to convert
an existing path:

.. code-block:: jinja

{{ absolute_url(asset(path)) }}

relative_path
~~~~~~~~~~~~~

.. code-block:: jinja

{{ relative_path(path) }}

``path``
**type**: ``string``

Returns a relative path for the given absolute path (based on the current
request path). For instance, if the current path is
``/article/news/welcome.html``, the relative path for ``/article/image.png`` is
``../images.png``.

expression
~~~~~~~~~~

Expand Down