summaryrefslogtreecommitdiff
path: root/templates/macros/blog.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/macros/blog.html')
-rw-r--r--templates/macros/blog.html13
1 files changed, 11 insertions, 2 deletions
diff --git a/templates/macros/blog.html b/templates/macros/blog.html
index 7f2ca60..13c2526 100644
--- a/templates/macros/blog.html
+++ b/templates/macros/blog.html
@@ -19,6 +19,16 @@
{% 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 %}
+
<article class="h-entry">
<header>
<div>
@@ -68,8 +78,7 @@
</dl>
</div>
{% if show_toc and post.render_toc %}
- {% set toc = post.body.toc|default([]) %}
- {{ render_toc(toc) }}
+ {{ render_toc(toc.items) }}
{% endif %}
</header>
<div class="e-content">{{ post.body }}</div>