diff --git a/layouts/partials/site_js.html b/layouts/partials/site_js.html
index 1ec5811e..3c6388cf 100644
--- a/layouts/partials/site_js.html
+++ b/layouts/partials/site_js.html
@@ -69,7 +69,7 @@
{{ end }}
{{/* Load hash anchors for documentation pages. */}}
- {{ if eq .Type "docs" }}
+ {{ if in (slice "book" "docs") .Type }}
{{ printf "" (printf $js.anchor.url $js.anchor.version) $js.anchor.sri | safeHTML }}