{% 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 %}
{% if post.publication_date %}
{% else %}
- ⚠
-
Missing publication date
{% endif %}
{% if latest_change and post.publication_date and latest_change.date > post.publication_date %}
- Last updated:
-
{% endif %}
{% if post.category %}
{% endif %}
- Reading time:
-
~{{ reading_time(post) }}
Dennis Fink
{% if show_toc and post.render_toc %}
{{ render_toc(toc.items) }}
{% endif %}
{{ post.body }}
{% 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 %}