diff options
Diffstat (limited to 'layouts/partials/scripts.html')
-rw-r--r-- | layouts/partials/scripts.html | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index 52c7c327f..08f400598 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -12,8 +12,12 @@ {{ partial "hooks/body-end.html" . }} <script type="text/javascript"> - $("body.td-page,body.td-section").find("main h2,h3,h4").each(function() { - var fragment = $(this).attr('id'); - $(this).append(' <a href="#'+fragment+'" class="header-link"><i class="fas fa-link"></i></a>'); - }); + if (location.pathname == "/docs" || location.pathname.startsWith("/docs/")) { + $("body.td-page,body.td-section").find("main h2,h3,h4").each(function() { + var fragment = $(this).attr('id'); + if (fragment !== undefined && fragment !== "") { + $(this).append(' <a href="#'+fragment+'" class="header-link"><i class="fas fa-link"></i></a>'); + } + }); + } </script> |