publishing Paxover to Codeberg
This commit is contained in:
44
templates/en/blog.html.twig
Normal file
44
templates/en/blog.html.twig
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
{% extends 'partials/base.html.twig' %}
|
||||
|
||||
{% if uri.param('tag') %}
|
||||
{% set page_title = theme_config.blog.tag_title | default('Tag: ') ~ uri.param('tag') %}
|
||||
{% else %}
|
||||
{% set page_title = theme_config.blog.title | default('Blog') %}
|
||||
{% endif %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% set collection = page.collection({
|
||||
'items': '@self.children',
|
||||
'pagination': true,
|
||||
'order': {'by': 'date', 'dir': 'desc'},
|
||||
'limit': theme_config.blog.pagination_limit})
|
||||
%}
|
||||
{% set itemsInCollection = page.collection({'items': collection.params.items})|length %}
|
||||
{% set currentPage = uri.param('page')|default('1') %}
|
||||
{% set itemsPerPage = collection.params.limit %}
|
||||
{% set pagesInCollection = (itemsInCollection / itemsPerPage)|round(0, 'ceil') %}
|
||||
|
||||
{% if page_title == 'Blog' %}
|
||||
{{ page.content | raw }}
|
||||
{% else %}
|
||||
<h2>{{ page_title }}</h2>
|
||||
{% endif %}
|
||||
<div class="blog">
|
||||
{% for child in collection %}
|
||||
{% include 'partials/blog-list-item.html.twig' with {blog: page, page: child} %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if itemsInCollection > itemsPerPage %}
|
||||
<div class="pagination">
|
||||
{% if currentPage != '1' %}
|
||||
<span class="pagination-newer"><a href="{{ page.url(true) ~ '/page' ~ system.param_sep ~ (currentPage - 1) }}">{{ theme_config.blog.pagination_newer_en }}</a></span>
|
||||
{% endif %}
|
||||
{% if (currentPage + 1) <= pagesInCollection %}
|
||||
<span class="pagination-older"><a href="{{ page.url(true) ~ '/page' ~ system.param_sep ~ (currentPage + 1) }}">{{ theme_config.blog.pagination_older_en}}</a></span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user