Skip to content

Commit

Permalink
added documentation for the new absolute_url() and relative_path() Tw…
Browse files Browse the repository at this point in the history
…ig functions
  • Loading branch information
fabpot committed Jan 23, 2015
1 parent ca54d55 commit e4d22f0
Showing 1 changed file with 32 additions and 0 deletions.
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

0 comments on commit e4d22f0

Please sign in to comment.