Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added documentation for the new absolute_url() and relative_path() Twig functions #4805

Merged
merged 1 commit into from
Jan 25, 2015
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