{% block banner %}
  {% load wagtailcore_tags wagtailimages_tags i18n %}

  {% if bannerpages %}
  {% for bannerpage in bannerpages %}
    <div class="banner">
      {% if bannerpage.banner %}
    	    {% if bannerpage.banner_link_page %}
    	       <a href="{% pageurl bannerpage.banner_link_page %}" target="_top" class="banner__item-link">
               {% image bannerpage.banner width-320 %}
             </a>
    	    {% elif bannerpage.external_link %}
    	       <a href="{{ bannerpage.external_link }}" target="_blank" class="banner__item-link">
               {% image bannerpage.banner width-320 %}
             </a>
    	    {% else %}
    	       {% image bannerpage.banner width-320 %}
    	    {% endif %}
      	{% endif %}
    </div>
  {% endfor%}
  {% endif %}

{% endblock %}
