diff --git a/sass/main.scss b/sass/main.scss index 8b6c37d..f25c2fa 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -121,4 +121,9 @@ header { margin-left: 10px; margin-right: 10px; } -} \ No newline at end of file +} + +.toc { + background-color: #f0f0f0; + padding: 8px; +} diff --git a/templates/macros/blog.html b/templates/macros/blog.html index 07bac94..79cbf9a 100644 --- a/templates/macros/blog.html +++ b/templates/macros/blog.html @@ -9,7 +9,7 @@
- Posted {% if post.extra.author %}by {{ post.extra.author }}{% endif %} + {{ post.reading_time }} min - Posted {% if post.extra.author %}by {{ post.extra.author }}{% endif %} on {{ post.date }} diff --git a/templates/macros/post.html b/templates/macros/post.html new file mode 100644 index 0000000..f6b180b --- /dev/null +++ b/templates/macros/post.html @@ -0,0 +1,12 @@ +{% macro render_toc(toc) %} + +{% endmacro %} diff --git a/templates/post.html b/templates/post.html index ffb974f..12411a3 100644 --- a/templates/post.html +++ b/templates/post.html @@ -1,4 +1,5 @@ {% extends "layout.html" %} +{% import "macros/post.html" as post %} {% block title %} {% if page.title %}{{ page.title }} - {% endif %} @@ -14,6 +15,13 @@ on {{ page.date }} {% endif %} + + {% if page.toc.children | length %} +
+ {{ post::render_toc(toc=page.toc) }} +
+ {% endif %} + {{ page.content | safe }} {% if page.extra.link %}

Visit here for more info.