fix: unify site URL resolution in build-docs.js

build-docs.js had its own hardcoded fallback URL
(bmad-code-org.github.io) instead of using the shared
getSiteUrl() function, causing URL mismatches between
robots.txt, llms.txt, and sitemaps. Now all components
resolve the site URL through the same function. Renamed
site-url.js to .mjs to avoid Node ESM detection warnings.
This commit is contained in:
Alex Verkhovsky 2026-02-05 19:45:58 -07:00
parent 7f1f7b614b
commit b2c047f0b7
4 changed files with 9 additions and 3 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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`;