{% load wagtailcore_tags wagtailimages_tags core_tags i18n %}

{% load_child_sections_for_section section as subsections %}
{% for subsection in subsections %}
  <h1 class="heading section-listing__theme-subsection_bg-title">
    <a href="{% pageurl subsection %}" class="section-listing__theme-subsection_bg-link">{{subsection.title}}</a>
  </h1>
  {% load_descendant_articles_for_section subsection count=None featured_in_homepage=True as articles %}
  {% if articles %}
  <ul class="promoted-article-list promoted-article-list--theme-bg">
  {% for article in articles %}
    <li class="promoted-article-list__item promoted-article-list__item--theme-bg">
      {% if article.get_effective_image %}
      <a href="{% pageurl article %}" class="promoted-article-list__anchor promoted-article-list__anchor--theme-bg">
        {% include "patterns/basics/images/article-thumbnail.html" with curve="none" %}
      </a>
      {% endif %}
      <a href="{% pageurl article %}" class="promoted-article-list__anchor promoted-article-list__anchor--theme-bg">
        <h3 class="heading promoted-article-list__heading">
          {{article.title}}
        </h3>
      </a>
      <p class="promoted-article-list__desc promoted-article-list__desc--theme-bg">{{ article.subtitle }}</p>
    </li>
  {% endfor%}
  </ul>
  <a href="{% pageurl subsection %}" class="subsection-list__theme-more-link">{% trans "View More" %}</a>
  {% endif %}
{% endfor %}
