{% from "macros/pagination.html" import render_pagination %} {% macro render_toc(toc, maxdepth=2) %} {% endmacro %} {% macro render_blog_post(post, show_toc=True) %} {% set toc = namespace(items=[]) %} {% if show_toc and post.render_toc %} {% for block in post.body.blocks %} {% if block._flowblock == "markdown" and block.text %} {% set toc.items = toc.items + (block.text.toc | default([])) %} {% endif %} {% endfor %} {% endif %} {% set latest_change = post.changelog.blocks | max(attribute="date") if post.changelog else none %}

{{ post.title }}

{% if post.publication_date %}
Posted:
{% else %} {% endif %} {% if latest_change and post.publication_date and latest_change.date > post.publication_date %}
Last updated:
{% endif %} {% if post.category %}
Category:
{% set category = site.get('/categories/'+post.category) %} {{ category.name }}
{% endif %}
{% if show_toc and post.render_toc %} {{ render_toc(toc.items) }} {% endif %}
{{ post.body }}
{% if post.tags or post.changelog %} {% endif %}
{% endmacro %} {% macro render_blog_index(pagination) %} {% for post in pagination.items %} {{ render_blog_post(post, False) }} {% if not loop.last %}
{% endif %} {% endfor %} {% if pagination.pages > 1 %} {% endif %} {% endmacro %}