title: Display something only once in a loop in twig
body: <p>I have some pics that I want to display by months.</p>
  
  <p>But I my code I get the month on top of every pics. </p>
  
  <p>How to avoid this ?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>{% for media in medias %}
      {% if media.date|date("m") == 10 and media.assetpath is not null %}
        &lt;h2&gt;Photos october&lt;/h2&gt;
        &lt;div class="col-xs-2"&gt;
          &lt;img class="img-responsive" src="{{ asset(media.assetpath)  }}"/&gt;
          &lt;/div&gt;
       {% elseif media.date|date("m") == 11 and media.assetpath is not null %}
         &lt;h2&gt;Photos november&lt;/h2&gt;
         &lt;div class="col-xs-2"&gt;
           &lt;img class="img-responsive" src="{{ asset(media.assetpath)  }}"/&gt;
          &lt;/div&gt;
      {% else %}
        &lt;h2&gt;other month&lt;/h2&gt;
        &lt;div class="col-xs-2"&gt;
          &lt;img class="img-responsive" src="{{ asset(media.assetpath)  }}"/&gt;
       &lt;/div&gt;
   {% endif %}
  {% endfor %}</code></pre>
  </div>
  </div>
  </p>