diff --git a/_includes/panel.html b/_includes/panel.html index 767964d..ff17f45 100644 --- a/_includes/panel.html +++ b/_includes/panel.html @@ -47,13 +47,13 @@ {% endif %} - {% if page.layout == 'post' and site.toc and page.toc %} -
- + {% if include.toc %} +
+ {{- site.data.label.panel.toc -}} - - -
+
+ +
{% endif %} diff --git a/_layouts/post.html b/_layouts/post.html index faf2d3f..35f241a 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -111,7 +111,15 @@ layout: default - {% include panel.html %} + {% assign enable_toc = false %} + + {% if site.toc and page.toc %} + {% if content contains ' diff --git a/assets/js/_utils/toc-filter.js b/assets/js/_utils/toc-filter.js deleted file mode 100644 index 1c4f8f9..0000000 --- a/assets/js/_utils/toc-filter.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Hide the empty ToC in posts. - * v2.0 - * https://github.com/cotes2020/jekyll-theme-chirpy - * © 2019 Cotes Chung - * MIT Licensed - */ - -$(function() { - if ($("#post-wrapper .post-content h1").length === 0 - && $("#post-wrapper .post-content h2").length === 0) { - $("#toc-wrapper").addClass("unloaded"); - } -}); \ No newline at end of file diff --git a/assets/js/post.min.js b/assets/js/post.min.js index c86d592..1536651 100644 --- a/assets/js/post.min.js +++ b/assets/js/post.min.js @@ -12,8 +12,6 @@ layout: compress {% include_relative lib/_bootstrap-toc.min.js %} -{% include_relative _utils/toc-filter.js %} - {% include_relative _utils/img-hyperlink.js %} {% include_relative _utils/lang-badge.js %}