From 0803c5f2a4868f065d6add23f8c1f0b4bb7560f4 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Sat, 22 Sep 2018 03:17:41 -0500 Subject: [PATCH] main website improvements --- sass/main.scss | 7 ++++++- templates/macros/blog.html | 2 +- templates/macros/post.html | 12 ++++++++++++ templates/post.html | 8 ++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 templates/macros/post.html 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.