misuzu/templates/news/index.twig
2023-09-08 20:40:48 +00:00

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 news_posts %}
{{ news_preview(post, true) }}
{% endfor %}
<div class="container" style="padding: 4px; display: {{ news_pagination.pages > 1 ? 'block' : 'none' }}">
{{ pagination(news_pagination, 'news-index') }}
</div>
</div>
<div class="news__sidebar">
<div class="container news__list">
{{ container_title('Categories') }}
<div class="container__content">
{% for category in news_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.postsCount }} post{{ category.postsCount == 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 %}