{% load wagtailcore_tags wagtailimages_tags %}
<div class="banner">
  {% if pageTag.banner %}
    {% image pageTag.banner width-360 as tmp_photo %}
    {% if pageTag.banner_link_page %}
      <a href="{% pageurl pageTag.banner_link_page.specific %}" target="_top" class="banner__item-link">
      <img alt="{{ pageTag.title }}" src="{{ tmp_photo.url }}" class="banner__image"/>
      </a>
    {% elif pageTag.external_link %}
      <a href="{{ pageTag.external_link }}" target="_blank" rel="noreferrer" class="banner__item-link">
      <img alt="{{ pageTag.title }}" src="{{ tmp_photo.url }}" class="banner__image"/>
      </a>
    {% else %}
      <img alt="{{ pageTag.title }}" src="{{ tmp_photo.url }}" class="banner__image"/>
    {% endif %}
  {% else %}
    <div class="banner__block">
      <div class="heading heading__subheading">
        <h3>{{pageTag.title}}</h3>
      </div>
      {% if pageTag.subtitle %}
        <p class="banner__subtitle">{{ pageTag.subtitle }}</p>
      {% endif %}

      {% trans "Click here for more" as buttontext %}
      {% if pageTag.external_link %}
        {% include "patterns/basics/buttons/sp_variations/button.html" with type="hyperlink" hyperlink=pageTag.external_link text=buttontext %}
      {% elif pageTag.banner_link_page %}
        {% pageurl pageTag.banner_link_page.specific as url %}
        {% include "patterns/basics/buttons/sp_variations/button.html" with type="hyperlink" hyperlink=url text=buttontext %}
      {% endif %}
  </div>
	{% endif %}
</div>
