Skip to content

Commit

Permalink
Test if document exists
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Feb 11, 2015
1 parent cfb8296 commit d94eeae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions themes/using_twig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,19 @@ Now, you can use ``DocumentViewer`` to generate HTML view for your documents no

.. code-block:: html+jinja

{# Grab only first document from “images” field #}
{% set image = nodeSource.images[0] %}

{# Always test if document exists #}
{% if image %}
{{ image.viewer.documentByArray({
'width':200,
'height':200,
'crop':"1:1",
'quality':75,
'embed':true
})|raw }}
{% endif %}

HTML output options
^^^^^^^^^^^^^^^^^^^
Expand Down

0 comments on commit d94eeae

Please sign in to comment.