diff --git a/scripts/search/server/server.js b/scripts/search/server/server.js index f83383d..cde5ca2 100644 --- a/scripts/search/server/server.js +++ b/scripts/search/server/server.js @@ -93,7 +93,8 @@ const server = http.createServer((req, res) => { if (!document.foundHeaderId && document.headersMap[id].toLocaleLowerCase().indexOf(searchQuery.toLocaleLowerCase()) > -1) { document.foundHeaderId = id; document.isExactMatch = document.headersMap[id].toLocaleLowerCase().trim() == searchQuery.toLocaleLowerCase().trim(); - document.uri += `#${id}`; + // 'top' is the internal id for the page title, so don't append in uri + document.uri += id === 'top' ? '' : `#${id}`; document.title = document.headersMap[id]; } }); diff --git a/themes/docs/layouts/partials/contentPage.html b/themes/docs/layouts/partials/contentPage.html index 7ec8f8e..bdd1012 100644 --- a/themes/docs/layouts/partials/contentPage.html +++ b/themes/docs/layouts/partials/contentPage.html @@ -4,7 +4,7 @@ {{ partial "breadcrumbs" . }}
-

+

{{.Title}}

{{ if .File }} diff --git a/themes/docs/static/js/main.js b/themes/docs/static/js/main.js index e85058c..bc5526b 100644 --- a/themes/docs/static/js/main.js +++ b/themes/docs/static/js/main.js @@ -231,7 +231,8 @@ document.addEventListener("DOMContentLoaded", function () { const anchors = document.querySelectorAll(".article h1, .article h2, .article h3, .article h4"); anchors.forEach(function (el) { let url = new URL(window.location.href); - el.insertAdjacentHTML('beforeend', ''); + const hash = el.id ? `#${el.id}` : ''; + el.insertAdjacentHTML('beforeend', ''); }); document.querySelectorAll('a.anchor').forEach(function (a) {