{% if items.number == 1 %}
{% comment %}Filter out the hero article from the featured articles{% endcomment %}
{% with hero_id=hero_article.0.id|default:0 %}
{% with main_article=items|first %}
{% if main_article.id != hero_id %}
{% include "components/_main_featured_article.html" with article=main_article %}
{% else %}
{% comment %}Hero article is the first item, use the second item as main{% endcomment %}
{% with main_article=items.1 %}
{% include "components/_main_featured_article.html" with article=main_article %}
{% endwith %}
{% endif %}
{% endwith %}
{% comment %}Get secondary featured articles, excluding the hero article{% endcomment %}
{% with featured_articles=items|slice:"1:3" %}
{% if items.0.id == hero_id %}
{% comment %}If first item was hero, shift the slice{% endcomment %}
{% with featured_articles=items|slice:"2:4" %}
{% include "components/_secondary_featured_articles.html" with featured_articles=featured_articles %}
{% endwith %}
{% else %}
{% include "components/_secondary_featured_articles.html" with featured_articles=featured_articles %}
{% endif %}
{% endwith %}
{% endwith %}
{% include "components/_pagination.html" %}
{% for article in items|slice:"3:" %}
{% include "components/_article_card.html" %}
{% endfor %}
{% include "components/_pagination.html" %}
{% else %}
{% for article in items %}
{% include "components/_article_card.html" with article=article %}
{% endfor %}
{% include "components/_pagination.html" %}
{% endif %}
{% endblock page_content %}