Skip to content

Commit b91287a

Browse files
authored
Merge pull request #217 from HarperDB/variable-baseurl
allow the docusaurus baseUrl to vary
2 parents 4104ccf + 14e079c commit b91287a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

site/docusaurus.config.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ if (process.env.NODE_ENV === 'production') {
2020
scripts.push({ src: 'js/reo.js' });
2121
}
2222

23+
// Determine base URL from environment variable or use defaults
24+
// For GitHub Pages deployment: DOCUSAURUS_BASE_URL=/documentation/
25+
// For local development: DOCUSAURUS_BASE_URL=/ (or unset)
26+
// Can also be set via command line: npm run build -- --base-url /documentation/
27+
const baseUrl = process.env.DOCUSAURUS_BASE_URL || '/';
28+
29+
// URL can also be overridden if needed
30+
const url = process.env.DOCUSAURUS_URL || 'https://docs.harperdb.io';
31+
32+
// Always log configuration at build time
33+
console.log('Docusaurus URL config:', { url, baseUrl });
34+
2335
const config: Config = {
2436
title: 'Harper Docs',
2537
tagline:
@@ -32,9 +44,9 @@ const config: Config = {
3244
},
3345

3446
// Set the production url of your site here
35-
url: 'https://docs.harperdb.io',
47+
url: url,
3648
// Set the /<baseUrl>/ pathname under which your site is served
37-
baseUrl: '/',
49+
baseUrl: baseUrl,
3850

3951
// Serve images from the repository root or from env var path
4052
staticDirectories: process.env.IMAGES_PATH ? ['static', process.env.IMAGES_PATH] : ['static', '../images'],

0 commit comments

Comments
 (0)