mirror of
https://github.com/litruv/Docs-Viewer.git
synced 2026-07-24 02:36:07 +10:00
Add dynamic title loading and set default page in index configuration
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"title": "Litruv",
|
||||
"defaultPage": "welcome",
|
||||
"documents": [
|
||||
{
|
||||
"title": "Welcome",
|
||||
|
||||
@@ -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-->
|
||||
|
||||
|
||||
10
index.js
10
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 = {};
|
||||
|
||||
Reference in New Issue
Block a user