{% extends 'master.twig' %}
{% from 'macros.twig' import news_post, pagination %}
{% set title = 'News' %}
{% set posts = category.posts|batch(3) %}
{% block content %}
<div class="announce-box">
<h1>{{ category.name }}</h1>
<h3>{{ category.description }}</h3>
</div>
<div class="content news">
<div class="content__header">News</div>
{% for post in posts[get.page|default(1) - 1] %}
{{ news_post(post, true, true) }}
{% endfor %}
<div>
<a href="{{ route('news.index') }}" class="input__button"><span class="fa fa-backward"></span> Back</a>
{% if posts|length > 1 %}
{{ pagination(route('news.category', category.id), posts|keys, get.page|default(1)) }}
{% endif %}
{% endblock %}