Skip to content
Open
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
15 changes: 15 additions & 0 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,18 @@ const DEAD_BLOG_SLUGS = new Set([
"where-to-buy-steam-deck-singapore",
"where-to-buy-xbox-series-x-singapore",
]);
// BUY-56945: 6 /best-* URLs that never had blog posts and return 404.
// Their /blog/ counterparts already return 410 Gone. These bare /best-* URLs
// should also return 410 to cleanly de-index them.
const DEAD_BEST_SLUGS = new Set([
"best-airpods-us",
"best-macbook-us",
"best-robot-vacuum-us",
"best-iphone-us",
"best-ipad-us",
"best-vacuum-us",
]);


function isDeadBlogSlug(pathname: string): boolean {
const normalized = normalizePathname(pathname);
Expand Down Expand Up @@ -217,6 +229,9 @@ function legacyRedirectPath(host: string, pathname: string): string | null {
if (ACTIVE_BLOG_SLUGS.has(slug)) {
return `/blog/${slug}`;
}
if (DEAD_BEST_SLUGS.has(slug)) {
return "__GONE__";
}
}

if (normalizedPath.startsWith("/blog/")) {
Expand Down