Add dynamic title loading and set default page in index configuration

This commit is contained in:
2025-02-09 19:18:19 +11:00
parent 790664b610
commit 3c61ab1e2e
3 changed files with 13 additions and 1 deletions

View File

@@ -1,4 +1,6 @@
{
"title": "Litruv",
"defaultPage": "welcome",
"documents": [
{
"title": "Welcome",

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<title>Litruv</title>
<title><!--title-->></title>
<!--ogmetadata-->

View File

@@ -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 = {};