-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
210 lines (191 loc) · 8.11 KB
/
docusaurus.config.js
File metadata and controls
210 lines (191 loc) · 8.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
// Load .env file into process.env (falls back gracefully if file is missing)
require('dotenv').config();
// ── Generate docs-content.json for the AI chatbot ────────────────────────────
// Runs every time Docusaurus starts or builds. Reads all .md files from /docs
// and writes them to /static/docs-content.json so the widget can fetch them.
(function generateDocsContent() {
const fs = require('fs');
const path = require('path');
const docsDir = path.join(__dirname, 'docs');
const outputDir = path.join(__dirname, 'static');
function slugify(text) {
return text.toString().toLowerCase()
.replace(/\s+/g, '-')
.replace(/[^\w\-]+/g, '')
.replace(/\-\-+/g, '-')
.replace(/^-+/, '')
.replace(/-+$/, '');
}
try {
const files = fs.readdirSync(docsDir)
.filter(f => f.endsWith('.md') || f.endsWith('.mdx'))
.sort();
const allSections = [];
let sectionId = 0;
files.forEach(file => {
const content = fs.readFileSync(path.join(docsDir, file), 'utf-8');
const fileName = file.replace(/\.mdx?$/, '');
const lines = content.split('\n');
let mainTitle = fileName.charAt(0).toUpperCase() + fileName.slice(1);
const fmMatch = content.match(/^title: (.*)$/m);
if (fmMatch) mainTitle = fmMatch[1].trim();
let currentTitle = mainTitle;
let currentContent = [];
let currentAnchor = '';
lines.forEach(line => {
// Match headers #, ##, ### (ignoring # for main title if it matches mainTitle)
const match = line.match(/^(#+)\s+(.*)$/);
if (match) {
const depth = match[1].length;
const title = match[2].trim();
// If we found a new header, push previous section
if (currentContent.length > 0 || currentTitle !== mainTitle) {
allSections.push({
id: sectionId++,
name: fileName,
parentTitle: mainTitle,
title: currentTitle,
content: currentContent.join('\n').trim(),
anchor: currentAnchor
});
}
currentTitle = title;
currentAnchor = slugify(currentTitle);
currentContent = [];
} else {
// Filter out frontmatter delimiters
if (line.trim() !== '---') {
currentContent.push(line);
}
}
});
if (currentContent.length > 0 || currentTitle !== mainTitle) {
allSections.push({
id: sectionId++,
name: fileName,
parentTitle: mainTitle,
title: currentTitle,
content: currentContent.join('\n').trim(),
anchor: currentAnchor
});
}
});
fs.writeFileSync(
path.join(outputDir, 'docs-content.json'),
JSON.stringify({ pages: allSections })
);
console.log(`[chatbot] Indexed ${allSections.length} doc sections → static/docs-content.json`);
} catch (e) {
console.warn('[chatbot] Could not generate docs-content.json:', e.message);
}
})();
module.exports = {
title: 'JMDT Documentation',
// ── Chatbot Widget API Key ────────────────────────────────────────────────
// Add your Gemini API key to .env: GEMINI_API_KEY=your_key_here
// .env is git-ignored — never commit it.
customFields: {
geminiApiKey: process.env.GEMINI_API_KEY || 'DT_GEMINI_API_KEY_PLACEHOLDER',
},
tagline: 'Scalable, Privacy-Preserving Layer 2 Blockchain',
url: 'https://docs.jmdt.io',
baseUrl: '/',
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/Frame_12.png',
organizationName: 'JupiterMeta',
projectName: 'docs',
trailingSlash: false,
themes: ['@docusaurus/theme-mermaid'],
themeConfig: {
navbar: {
title: '',
logo: {
alt: 'JMDT Logo',
src: 'img/jmdt_logo_dark.png',
srcDark: 'img/jmdt_logo.png',
},
items: [
{ type: 'doc', docId: 'intro', position: 'left', label: 'Docs' },
{
type: 'dropdown',
label: 'Networks',
position: 'left',
items: [
{ label: 'Mainnet', to: '/docs/mainnet/overview' },
{ label: 'Testnet', to: '/docs/testnet/overview' },
],
},
{ href: 'https://jmdt.io', label: 'jmdt.io', position: 'right' },
{ href: 'https://github.com/JupiterMetaLabs/docs', label: 'GitHub', position: 'right' },
],
},
footer: {
// style: 'dark',
links: [
{
title: 'Links',
items: [
{ label: 'JMDT', to: 'https://jmdt.io' },
{ label: 'GitHub', to: 'https://github.com/JupiterMetaLabs/docs' },
],
},
{
title: 'Community',
items: [
{ label: 'LinkedIn', href: 'https://www.linkedin.com/company/jmdt-blockchain' },
{ label: 'Twitter', href: 'https://x.com/JMDT_Blockchain' },
{ label: 'Discord', href: 'https://discord.gg/ntNU3Qed' },
],
},
],
copyright: `© ${new Date().getFullYear()} JMDT. All Rights Reserved.`,
},
colorMode: {
defaultMode: 'dark', // Ensuring default dark mode to match ZKJM.io
disableSwitch: false,
respectPrefersColorScheme: true,
},
// ── SEO: Global default meta tags injected on every page ─────────────
metadata: [
{ name: 'description', content: 'JMDT is an Ethereum Layer 2 blockchain with Zero-Knowledge Proofs, Decentralized Identity (DID), and AVC consensus for privacy, scalability, and security.' },
{ name: 'keywords', content: 'JMDT, Jupiter Meta Data Token, Ethereum Layer 2, ZK Proofs, Zero-Knowledge Proofs, Decentralized Identity, DID, L2 Blockchain, zk-rollups, AVC, smart contracts, Web3, privacy blockchain, scalable blockchain' },
{ name: 'author', content: 'JupiterMetaLabs' },
{ name: 'robots', content: 'index, follow' },
// Open Graph defaults for all doc pages
{ property: 'og:type', content: 'website' },
{ property: 'og:site_name', content: 'JMDT Documentation' },
{ property: 'og:image', content: 'https://docs.jmdt.io/img/og-new.png' },
{ property: 'og:image:width', content: '1200' },
{ property: 'og:image:height', content: '630' },
// Twitter Card defaults for all pages
{ name: 'twitter:card', content: 'summary_large_image' },
{ name: 'twitter:site', content: '@JMDT' },
{ name: 'twitter:image', content: 'https://docs.jmdt.io/img/og-new.png' },
],
},
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/JupiterMetaLabs/docs/edit/main/',
// ── AEO: Breadcrumb structured data for every doc page ─────────
breadcrumbs: true,
},
// ── SEO: Sitemap auto-generation ─────────────────────────────────
sitemap: {
changefreq: 'weekly',
priority: 0.8,
ignorePatterns: ['/tags/**'],
filename: 'sitemap.xml',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
},
],
],
markdown: { mermaid: true },
};