{% macro newsitem(item) %}
<section class="newsitem">
    <header>
        <a href="{{ item.permalink | safe}}">{{ item.title }}</a>
        <time> {{ item.date | date }} </time>
    </header>
    <summary>
        {{ item.summary | safe }}
    </summary>

    <a href="{{ item.permalink }}">Läs mer...</a>
</section>
{% endmacro newsitem %}

{% macro latest_news() %}
{% set news = get_section(path="news/_index.md") %}
    {% for page in news.pages | sort(attribute="date") | slice(start=-5) | reverse %}
      {{ macros::newsitem(item=page) }}
    {% endfor %}
{% endmacro latest_news %}
