mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add fragment links only on docs pages
Add fragment links only on docs pages and only when there is an 'id' attribute.
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user