From 3c61ab1e2e8aba2c571e1361554adddd3ce80b8f Mon Sep 17 00:00:00 2001 From: Litruv Date: Sun, 9 Feb 2025 19:18:19 +1100 Subject: [PATCH] Add dynamic title loading and set default page in index configuration --- example.index.json | 2 ++ index.html | 2 +- index.js | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/example.index.json b/example.index.json index a5c0510..8b16978 100644 --- a/example.index.json +++ b/example.index.json @@ -1,4 +1,6 @@ { + "title": "Litruv", + "defaultPage": "welcome", "documents": [ { "title": "Welcome", diff --git a/index.html b/index.html index 7a3e832..d25a317 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - Litruv + <!--title-->> diff --git a/index.js b/index.js index 1c1bcff..21b2f96 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,13 @@ +fetch('index.json') + .then(response => response.json()) + .then(data => { + document.title = data.title || 'Documentation'; + }) + .catch(error => { + console.error('Error loading title:', error); + document.title = 'Documentation'; + }); + class EventBus { constructor() { this.events = {};