{% load wagtailimages_tags banner_tags %}

{% get_banners "home" first=True as banner %}
{% if banner %}
  <div class="home-banner">
    {% if banner.link_url %}
      <a class="home-banner__link" href="{{ banner.link_url }}">
        {% image banner.image width-1280 alt=banner.title %}
        {% if banner.title %}
          <span class="home-banner__title">{{ banner.title }}</span>
        {% endif %}
        {% if banner.link_text %}
          <span class="home-banner__cta">{{ banner.link_text }}</span>
        {% endif %}
      </a>
    {% else %}
      {% image banner.image width-1280 alt=banner.title %}
    {% endif %}
  </div>
{% endif %}
