hazelnut.dev/templates/page.html

57 lines
1.3 KiB
HTML
Raw Normal View History

2020-09-09 01:10:48 +00:00
{% extends "base.html" %}
{% block title %}{{ page.title }} - Hazelnut{% endblock title %}
{% block content %}
2020-12-21 14:49:03 +00:00
2020-12-23 18:23:38 +00:00
<h1 class="post-title">{{ page.title }}</h1>
<p class="post-date">{{ page.date | date() }}</p>
2020-12-21 14:49:03 +00:00
{% if page.extra.toc %}
2021-03-27 03:10:57 +00:00
<h1>Table of Contents <!--<span id="toc-toggle">[-]</span>--></h1>
2020-12-21 14:49:03 +00:00
<div id="toc">
2021-02-26 19:02:34 +00:00
<ol>
2020-09-09 01:10:48 +00:00
{% for h1 in page.toc %}
<li>
2020-09-09 02:47:54 +00:00
<a class="internal" href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
2020-09-09 01:10:48 +00:00
{% if h1.children %}
2021-02-26 19:02:34 +00:00
<ol>
2020-09-09 01:10:48 +00:00
{% for h2 in h1.children %}
<li>
2020-09-09 02:47:54 +00:00
<a class="internal" href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
2020-09-09 01:10:48 +00:00
</li>
{% endfor %}
2021-02-26 19:02:34 +00:00
</ol>
2020-09-09 01:10:48 +00:00
{% endif %}
</li>
{% endfor %}
2021-02-26 19:02:34 +00:00
</ol>
2020-12-21 14:49:03 +00:00
</div>
<script>
var shown = false;
var toggle = document.getElementById("toc-toggle");
var toc = document.getElementById("toc");
function update() {
if (shown) {
toc.style.display = "block";
toggle.innerHTML = "[-]";
} else {
toc.style.display = "none";
toggle.innerHTML = "[+]";
}
}
toggle.parentNode.addEventListener("click", function() {
shown = !shown;
update();
});
update();
</script>
{% endif %}
2020-09-09 01:10:48 +00:00
{{ page.content | safe }}
2020-12-21 14:49:03 +00:00
2020-09-09 01:10:48 +00:00
{% endblock content %}