{% 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 %}

{{ post.title }}

{% if post.publication_date %}
Posted:
{% else %} {% endif %} {% if post.updated_date and post.publication_date and (post.updated_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 %} {% 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 %}