{# MIT License Copyright (c) 2021 vuquangtrong Copyright (c) 2021 Liang Yesheng Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #} {% block style %} {% endblock %} {% set page_num = (pages|count / page_size)|round(method='ceil')|int %} {% if page_num == 0 or not paging %} {% set page_num = 1 %} {% if not paging %} {% set page_size = 10000 %} {% endif %} {% endif %} {# Define a macro to render tags, if not prodided. #} {% if render_tags is not defined %} {% from "blog-tags-render.html" import render_tags %} {% endif %} {% if get_tags_style is not defined %} {% from "blog-tags-render.html" import get_tags_style %} {% endif %} {% block tags_style %} {% call get_tags_style() %} {% endcall %} {% endblock %} {# Render blogs. If a marco is provided, then use the marco to render. #} {% if render_blog is not defined %} {% macro render_blog(title, description, time, url, pg) -%}

{{ title }}

{% if show_tags and "tags" in pg.meta %} {% call render_tags(pg.meta["tags"], index_url) %} {% endcall %} {% endif %}

{{ description }}

{{ ("Updated" if is_revision else "Published") + " at: " + time }}

{{ caller() }} {%- endmacro %} {% endif %}
{% for page_idx in range(0, page_num) %} {% set pg_group = pages[page_idx*page_size:(page_idx + 1)*page_size] %}
{% for pg in pg_group %} {# Setting variables. #} {% set url = pg.canonical_url %} {% set title = pg.title %} {% if pg.meta and pg.meta.title_full %} {% set title = pg.meta.title_full %} {% endif %} {% set description = "" %} {% if pg.meta.description %} {% set description = pg.meta.description|truncate %} {% endif %} {% set time = "" %} {% if pg.meta and pg.meta["localized-time"] %} {% set time = pg.meta["localized-time"] %} {% endif %} {% call render_blog(title, description, time, url, pg) %} {% endcall %} {% endfor %}
{% endfor %}
{% for num in range(page_num) %} {{ num + 1 }} {% endfor %}
{% if show_total %}
Total {{ pages|count }} posts.
{% endif %}