diff --git a/scripts/seo-audit.mjs b/scripts/seo-audit.mjs index e0354068..ba866cee 100644 --- a/scripts/seo-audit.mjs +++ b/scripts/seo-audit.mjs @@ -11,6 +11,7 @@ const SITE_URL = (process.env.SITE_URL || 'https://www.bentopdf.com').replace( /\/+$/, '' ); +const BASE_PATH = (process.env.BASE_URL || '/').replace(/\/$/, ''); const HOST = new URL(SITE_URL).hostname; const NOINDEX_ALLOWLIST = new Set(['404.html', 'wasm-settings.html']); @@ -72,6 +73,7 @@ function expectedCanonicalForFile(rel) { const baseName = fileName.replace(/\.html$/, ''); const slug = baseName === 'index' ? '' : baseName; const segments = [SITE_URL]; + if (BASE_PATH) segments.push(BASE_PATH.replace(/^\//, '')); if (slug) segments.push(slug); return segments.join('/').replace(/\/+$/, '') || SITE_URL; }