Skip to content

Commit

Permalink
Merge pull request #2387 from starknet-io/bugfix/fix-blog-redirects
Browse files Browse the repository at this point in the history
Fix blog redirects
  • Loading branch information
rafaelcruzazevedo authored Jan 29, 2024
2 parents ba38047 + 7bc7b43 commit d8126ad
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions workspaces/website/functions/[[route]].ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,35 @@ redirects.items.forEach(({ source, destination }) => {
);
});

/**
* Redirects for old posts.
*/

router.get(
'/:locale?/posts/:category',
(req: IRequest, _context: EventContext<{}, any, Record<string, unknown>>) => {
return Response.redirect(
new URL(
`${req.params.locale ? `/${req.params.locale}` : ``}/content/category/${req.params.category}`,
req.url
),
301);
}
);

router.get(
'/:locale?/posts/:cat/:slug',
(req: IRequest, _context: EventContext<{}, any, Record<string, unknown>>) => {
return Response.redirect(
new URL(
`${req.params.locale ? `/${req.params.locale}` : ``}/content/${req.params.slug}`,
req.url
),
301);
}
);


async function ittyAssetshandler(
req: IRequest,
context: EventContext<{}, any, Record<string, unknown>>
Expand Down

0 comments on commit d8126ad

Please sign in to comment.