misuzu/templates/news/category.twig

46 lines
1.8 KiB
Twig

{% extends 'news/master.twig' %}
{% from 'macros.twig' import pagination, container_title %}
{% from 'news/macros.twig' import news_preview %}
{% set title = category.category_name ~ ' :: News' %}
{% set manage_link = url_construct('/manage/news.php', {'v':'category','c':category.category_id}) %}
{% set canonical_url = url_construct('/news.php', {
'c': category.category_id,
'p': news_pagination.page > 2 ? news_pagination.page : 0,
}) %}
{% 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, '/news.php', null, {'c':category.category_id}, 'page') }}
</div>
</div>
<div class="news__sidebar">
<div class="container news__list">
{{ container_title('News » ' ~ category.category_name) }}
<div class="container__content">
{{ category.category_description|length > 0 ? category.category_description : '' }}
</div>
</div>
{% if featured|length > 0 %}
<div class="container news__list">
{{ container_title('Featured Posts') }}
<div class="container__content">
{% for featured_post in featured %}
<a class="news__list__item" href="/news.php?p={{ featured_post.post_id }}">{{ featured_post.post_title }}</a>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
{% endblock %}