misuzu/templates/news/index.twig

79 lines
2.7 KiB
Twig
Raw Permalink Normal View History

2022-09-13 13:14:49 +00:00
{% 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">
2023-07-15 17:02:46 +00:00
{% for post in news_posts %}
2022-09-13 13:14:49 +00:00
{{ 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">
2023-07-15 17:02:46 +00:00
{% for category in news_categories %}
2022-09-13 13:14:49 +00:00
<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">
2023-07-15 17:02:46 +00:00
{{ category.postsCount }} post{{ category.postsCount == 1 ? '' : 's' }}
2022-09-13 13:14:49 +00:00
</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 %}