Skip to content

Commit

Permalink
Merge pull request #166 from storybookjs/revert-161-redirects
Browse files Browse the repository at this point in the history
Revert "Add redirects for tags"
  • Loading branch information
cdedreuille committed Jul 9, 2024
2 parents 4b6f96a + 25fb828 commit fc09268
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 27 deletions.
16 changes: 14 additions & 2 deletions apps/frontpage/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
import { cookieRenderId } from './constants';
import { listOfRedirects } from './redirects/redirects';
import { docsVersionsRedirects } from './redirects/docs-versions-redirects';
import { RedirectData } from './redirects/types';
import { docsRenderersRedirects } from './redirects/docs-renderers-redirects';
import { docsCommonRedirects } from './redirects/docs-common-redirects';

export async function middleware(request: NextRequest) {
let searchParam = request.nextUrl.searchParams.get('renderer');
const pathname: string = request.nextUrl.pathname;

for (const redirectData of listOfRedirects) {
// Merge all redirects into a single list
// The order of the list is important
// The first matching redirect will be used
const redirectList: RedirectData[] = [
...docsVersionsRedirects,
...docsRenderersRedirects,
...docsCommonRedirects,
];

for (const redirectData of redirectList) {
let sourcePattern = redirectData.source;
let destinationURL = redirectData.destination;

Expand Down
16 changes: 0 additions & 16 deletions apps/frontpage/redirects/redirects.ts

This file was deleted.

9 changes: 0 additions & 9 deletions apps/frontpage/redirects/redirects_tags.ts

This file was deleted.

0 comments on commit fc09268

Please sign in to comment.