1
0

More universal macro for listing posts

This commit is contained in:
Emil Miler 2021-12-04 18:20:01 +01:00
parent e20c485d03
commit 194fcc5b92
2 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@
</aside> </aside>
<main> <main>
{% block content %} {% block content %}
{{ macros::posts_latest(section="posts", count=config.extra.latest_posts_count) }} {{ macros::list_posts(section="posts", count=config.extra.latest_posts_count) }}
{% endblock %} {% endblock %}
</main> </main>
</body> </body>

View File

@ -1,7 +1,7 @@
{% macro posts_latest(section, count) %} {% macro list_posts(section, count=0) %}
{% set section = get_section(path=section~"/_index.md") %} {% set section = get_section(path=section~"/_index.md") %}
{% for page in section.pages %} {% for page in section.pages %}
{% if loop.index > count %} {% if loop.index > count and count != 0 %}
{% break %} {% break %}
{% endif %} {% endif %}
{{ macros::print_article(page=page) }} {{ macros::print_article(page=page) }}