Add an inline table of contents for small screens

This ToC is only shown when the screen is too small for the sticky sidebar ToC.

We use a `<!-- toc -->` comment and the `replace` function to allow inserting the ToC at well defined points of the page. We don't use the shortcode feature of Zola because of https://github.com/getzola/zola/issues/584.
This commit is contained in:
Philipp Oppermann
2019-03-19 12:55:18 +01:00
parent d0c0cd8ed7
commit 6055a2e342
3 changed files with 21 additions and 1 deletions

View File

@@ -34,7 +34,7 @@
</li>{% endfor %}
</ol>
</aside>
{{ page.content | safe }}
{{ page.content | safe | replace(from="<!-- toc -->", to=macros::toc(page=page))}}
<div class="post-footer-support">
<h2>Support Me</h2>