From adaa6c87746e7e51f5e8225e68218c0eed70ad28 Mon Sep 17 00:00:00 2001 From: Litruv Date: Sun, 9 Feb 2025 19:25:47 +1100 Subject: [PATCH] Add dynamic document title setting on data load --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 21b2f96..d16b949 100644 --- a/index.js +++ b/index.js @@ -530,12 +530,14 @@ class Documentation { const data = await response.json(); this.indexData = data; window._indexData = data; + + window.originalDocTitle = data.title || 'Documentation'; + document.title = window.originalDocTitle; this.domService.elements.fileIndex.innerHTML = ''; this.indexData.documents.forEach(doc => this.domService.createFileIndexItem(doc, this.domService.elements.fileIndex)); - // Use defaultPage from index.json const params = new URLSearchParams(window.location.search); let slug = ''; if (params.has('')) { @@ -550,7 +552,6 @@ class Documentation { await this.loadDocumentBySlug(slug); - // Handle hash after load using DOMService's scrollToElement if (window.location.hash) { setTimeout(() => { const element = document.getElementById(window.location.hash.slice(1)); @@ -601,7 +602,6 @@ class Documentation { window._currentPath = path; - // Handle hash scrolling after content is loaded if (window.location.hash) { const element = document.getElementById(window.location.hash.slice(1)); if (element) {