diff --git a/tools/build-docs.js b/tools/build-docs.js index dfb2c0a8e..878eeee8f 100644 --- a/tools/build-docs.js +++ b/tools/build-docs.js @@ -21,7 +21,7 @@ const archiver = require('archiver'); const PROJECT_ROOT = path.dirname(__dirname); const BUILD_DIR = path.join(PROJECT_ROOT, 'build'); -const SITE_URL = process.env.SITE_URL || 'https://bmad-code-org.github.io/BMAD-METHOD'; +let SITE_URL; // Resolved in main() via shared getSiteUrl() const REPO_URL = 'https://github.com/bmad-code-org/BMAD-METHOD'; // DO NOT CHANGE THESE VALUES! @@ -53,6 +53,12 @@ const LLM_EXCLUDE_PATTERNS = [ */ async function main() { + // Resolve site URL using the same function as Astro config + const { pathToFileURL } = require('node:url'); + const siteUrlModule = path.join(PROJECT_ROOT, 'website/src/lib/site-url.mjs'); + const { getSiteUrl } = await import(pathToFileURL(siteUrlModule).href); + SITE_URL = getSiteUrl(); + console.log(); printBanner('BMAD Documentation Build Pipeline'); console.log(); diff --git a/website/astro.config.mjs b/website/astro.config.mjs index 23a3179c4..d59de430a 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -4,7 +4,7 @@ import starlight from '@astrojs/starlight'; import sitemap from '@astrojs/sitemap'; import rehypeMarkdownLinks from './src/rehype-markdown-links.js'; import rehypeBasePaths from './src/rehype-base-paths.js'; -import { getSiteUrl } from './src/lib/site-url.js'; +import { getSiteUrl } from './src/lib/site-url.mjs'; const siteUrl = getSiteUrl(); const urlParts = new URL(siteUrl); diff --git a/website/src/components/Banner.astro b/website/src/components/Banner.astro index f1e460705..218a017ee 100644 --- a/website/src/components/Banner.astro +++ b/website/src/components/Banner.astro @@ -1,5 +1,5 @@ --- -import { getSiteUrl } from '../lib/site-url.js'; +import { getSiteUrl } from '../lib/site-url.mjs'; const SITE_URL = getSiteUrl(); const fullDocsUrl = `${SITE_URL}/llms-full.txt`; diff --git a/website/src/lib/site-url.js b/website/src/lib/site-url.mjs similarity index 100% rename from website/src/lib/site-url.js rename to website/src/lib/site-url.mjs