misuzu/templates/news/index.twig

78 lines
2.7 KiB
Twig

{% extends 'news/master.twig' %}
{% from 'macros.twig' import pagination, container_title %}
{% from 'news/macros.twig' import news_preview %}
{% set title = 'News' %}
{% set canonical_url = url('news-index', {
'page': news_pagination.page > 2 ? news_pagination.page : 0,
}) %}
{% set manage_link = url('manage-news-categories') %}
{% set feeds = [
{
'type': 'rss',
'title': '',
'url': url('news-feed-rss'),
},
{
'type': 'atom',
'title': '',
'url': url('news-feed-atom'),
},
] %}
{% block content %}
<div class="news__container">
<div class="news__preview__listing">
{% for post in posts %}
{{ news_preview(post) }}
{% endfor %}
<div class="container" style="padding: 4px; display: {{ news_pagination.pages > 1 ? 'block' : 'none' }}">
{{ pagination(news_pagination, url('news-index')) }}
</div>
</div>
<div class="news__sidebar">
<div class="container news__list">
{{ container_title('Categories') }}
<div class="container__content">
{% for category in categories %}
<a class="news__list__item news__list__item--kvp" href="{{ url('news-category', {'category': category.id}) }}">
<div class="news__list__name">
{{ category.name }}
</div>
<div class="news__list__value">
{{ category.postCount }} post{{ category.postCount == 1 ? '' : 's' }}
</div>
</a>
{% endfor %}
</div>
</div>
<div class="container">
{{ container_title('Feeds') }}
<div class="news__feeds">
<a href="{{ url('news-feed-atom') }}" class="news__feed">
<div class="news__feed__icon">
<i class="fas fa-rss"></i>
</div>
<div class="news__feed__type">
Atom
</div>
</a>
<a href="{{ url('news-feed-rss') }}" class="news__feed">
<div class="news__feed__icon">
<i class="fas fa-rss"></i>
</div>
<div class="news__feed__type">
RSS
</div>
</a>
</div>
</div>
</div>
</div>
{% endblock %}