Skip to content

Commit

Permalink
redirect from old docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rossrobino committed Feb 7, 2025
1 parent eff081f commit 8ec5ab3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions apps/docs/src/server/+func.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ export const handler: Handler = async (req) => {
return Response.redirect(url, 301);
}

// redirect from old docs
if (url.pathname.startsWith("/docs/")) {
const element = url.pathname.split("/").at(2);

if (element) {
if (element === "details" || element === "popover") {
url.pathname = `/styles/${element}/`;
} else {
url.pathname = `/elements/${element}`;
}

return Response.redirect(url, 301);
}
}

return notFound(url.pathname);
};

Expand Down

0 comments on commit 8ec5ab3

Please sign in to comment.