Fix ToC incorrectly display the contents of the panel

Bug introduced in the commit `b518c9d`
This commit is contained in:
Cotes Chung 2021-12-07 14:53:48 +08:00
parent cf8dae9454
commit 007d242e87
1 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,14 @@
{% assign enable_toc = false %}
{% if site.toc and page.toc %} {% if site.toc and page.toc %}
{% if page.content contains '<h2' or page.content contains '<h3' %}
{% assign enable_toc = true %}
{% endif %}
{% endif %}
{% if enable_toc %}
<!-- BS-toc.js will be loaded at medium priority --> <!-- BS-toc.js will be loaded at medium priority -->
<script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js"></script>
<div id="toc-wrapper" class="pl-0 pr-4 mb-5"> <div id="toc-wrapper" class="pl-0 pr-4 mb-5">
<h4 class="pl-3 pt-2 mb-2"> <h4 class="pl-3 pt-2 mb-2">
{{- site.data.locales[lang].panel.toc -}} {{- site.data.locales[lang].panel.toc -}}