diff --git a/packages/astro-theme/components/BaseHead.astro b/packages/astro-theme/components/BaseHead.astro index e4e6e6599..9c44a20d9 100644 --- a/packages/astro-theme/components/BaseHead.astro +++ b/packages/astro-theme/components/BaseHead.astro @@ -36,7 +36,7 @@ const browserpodCanonicals: Record = { const normalisedPath = Astro.url.pathname.replace(/(?:\.html|\/)$/, ""); const canonicalURL = browserpodCanonicals[normalisedPath] ? new URL(browserpodCanonicals[normalisedPath]) - : new URL(Astro.url.pathname, canonicalSite); + : new URL(normalisedPath || "/", canonicalSite); const product = productFromUrl(canonicalURL); const favicon = product?.favicon ?? companyFavicon.src; @@ -118,7 +118,7 @@ const gtmScript = - + @@ -126,7 +126,7 @@ const gtmScript = - + diff --git a/sites/browserpod/public/_redirects b/sites/browserpod/public/_redirects index 7b69f84f4..021bbe4ac 100644 --- a/sites/browserpod/public/_redirects +++ b/sites/browserpod/public/_redirects @@ -1,3 +1,3 @@ -/docs/:page.html /docs/:page 301 -/docs/:category/:page.html /docs/:category/:page 301 -/docs/:cat1/:cat2/:page.html /docs/:cat1/:cat2/:page 301 \ No newline at end of file +/docs/:page.html /docs/:page 301 +/docs/:category/:page.html /docs/:category/:page 301 +/docs/:cat1/:cat2/:page.html /docs/:cat1/:cat2/:page 301 diff --git a/sites/browserpod/src/pages/sitemap.xml.ts b/sites/browserpod/src/pages/sitemap.xml.ts index e6d1f600a..9444579ea 100644 --- a/sites/browserpod/src/pages/sitemap.xml.ts +++ b/sites/browserpod/src/pages/sitemap.xml.ts @@ -19,21 +19,13 @@ export const GET: APIRoute = async () => { return true; }); - // The /docs/ landing page is served by the theme's pages/docs/index.astro, - // not the content collection, so it isn't in `entries`. Add it explicitly. - const landingUrl = `${BASE}/docs/`; - + // The /docs/ landing page is served by the theme's pages/docs/index.astro, and it's only an html redirect, so it's not in the nav. // entry.href is already "/docs/". Normalise and drop duplicates. const innerUrls = Array.from( new Set(entries.map((entry) => `${BASE}${entry.href}`)) ).sort(); - const pages = [ - { loc: landingUrl, priority: "0.8" }, - ...innerUrls - .filter((u) => u !== landingUrl) - .map((loc) => ({ loc, priority: "0.7" })), - ]; + const pages = innerUrls.map((loc) => ({ loc, priority: "0.7" })); const xml = `