diff options
author | Ian Lewis <ianlewis@google.com> | 2020-01-17 01:47:38 -0500 |
---|---|---|
committer | Ian Lewis <ianlewis@google.com> | 2020-01-17 01:47:38 -0500 |
commit | 6d055f33a19203b8589142b74737dbe5f67d18e3 (patch) | |
tree | a19d52458e1453b48d4c568f70bbb114ad30aed2 /layouts/partials/scripts.html | |
parent | c73410c0bda98fa617d82cf423ce96ee5e6af6a4 (diff) | |
parent | dcd8504d9866a9b0d95fadbff79e599f5d6893db (diff) |
Merge branch 'master' into lint-md
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> |