Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/astro-theme/components/BaseHead.astro
Comment thread
codingfrog27 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const browserpodCanonicals: Record<string, string> = {
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;
Expand Down Expand Up @@ -118,15 +118,15 @@ const gtmScript =

<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta property="og:url" content={Astro.url} />
<meta property="og:url" content={canonicalURL} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content={new URL(image, Astro.url)} />
<meta property="og:site_name" content={SITE_TITLE} />

<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content={Astro.url} />
<meta property="twitter:url" content={canonicalURL} />
<meta property="twitter:title" content={title} />
<meta property="twitter:description" content={description} />
<meta property="twitter:image" content={new URL(image, Astro.url)} />
Expand Down
6 changes: 3 additions & 3 deletions sites/browserpod/public/_redirects
Original file line number Diff line number Diff line change
@@ -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
/docs/:page.html /docs/:page 301
/docs/:category/:page.html /docs/:category/:page 301
/docs/:cat1/:cat2/:page.html /docs/:cat1/:cat2/:page 301
12 changes: 2 additions & 10 deletions sites/browserpod/src/pages/sitemap.xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/<slug>". 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 = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
Expand Down
Loading