Move toc_aside out of <main>

This way, we avoid that the table of contents is picked for link previews by third-party sites.
This commit is contained in:
Philipp Oppermann
2020-03-27 18:02:46 +01:00
parent 6163821401
commit 74969cd1be
2 changed files with 22 additions and 17 deletions

View File

@@ -32,7 +32,10 @@
</div>
</header>
<main>{% block main %}{% endblock main %}</main>
<div>
{% block toc_aside %}{% endblock toc_aside %}
<main>{% block main %}{% endblock main %}</main>
</div>
<div>{% block after_main %}{% endblock after_main %}</div>

View File

@@ -15,6 +15,23 @@
{{ page.summary | safe | striptags | truncate(length=150) }}
{%- endblock description %}
{% block toc_aside %}
<aside id="toc-aside">
<h2>Table of Contents</h2>
<ol>
{% for h2 in page.toc %}<li>
<a href="#{{h2.id | safe}}">{{ h2.title | safe }}</a>
{% if h2.children %}<ol>
{% for h3 in h2.children %}<li>
<a href="#{{h3.id | safe}}">{{ h3.title | safe }}</a>
</li>{% endfor %}
</ol>{% endif %}
</li>{% endfor %}
<li class="toc-comments-link"><a href="#comments">Comments</a></li>
</ol>
</aside>
{% endblock toc_aside %}
{% block main %}
<h1>{{ page.title }}</h1>
<time datetime="{{ page.date | date(format="%Y-%m-%d") }}" class="post-date">
@@ -22,21 +39,6 @@
{% if page.extra.updated %} (updated on {{ page.extra.updated | date(format="%b %d, %Y") }}) {% endif %}
</time>
<aside id="toc-aside">
<h2>Table of Contents</h2>
<ol>
{% for h2 in page.toc %}<li>
<a href="#{{h2.id | safe}}">{{ h2.title | safe }}</a>
{% if h2.children %}<ol>
{% for h3 in h2.children %}<li>
<a href="#{{h3.id | safe}}">{{ h3.title | safe }}</a>
</li>{% endfor %}
</ol>{% endif %}
</li>{% endfor %}
<li class="toc-comments-link"><a href="#comments">Comments</a></li>
</ol>
</aside>
{% if page.extra.warning %}
<div class="warning">
{% if page.extra.warning_short %} <b>{{ page.extra.warning_short }}</b> {% endif %}
@@ -101,4 +103,4 @@
{%- endif %}
</aside>
{% endblock after_main %}
{% endblock main %}