Skip to content

Commit

Permalink
bugfix when no headings are present
Browse files Browse the repository at this point in the history
  • Loading branch information
bedroesb committed Aug 23, 2024
1 parent d7cf9ff commit 0c3561a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions assets/js/toc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// https://github.com/ghiculescu/jekyll-table-of-contents
// Modified from: https://github.com/ghiculescu/jekyll-table-of-contents
(function ($) {
$.fn.toc = function (options) {
var defaults = {
Expand Down Expand Up @@ -37,13 +37,14 @@
}
return this.id;
}), output = $(this);

// Check if there are any headers
if (!headers.length || headers.length < settings.minimumHeaders || !output.length) {

$('#main').removeClass("add-grid");
$("#toc").hide();

}

return; // Exit early if there are no headers
}

if (0 === settings.showSpeed) {
settings.showEffect = 'none';
Expand Down

0 comments on commit 0c3561a

Please sign in to comment.