Skip to content

Commit

Permalink
redirect app for developers hub
Browse files Browse the repository at this point in the history
  • Loading branch information
ashucoder9 committed Dec 24, 2024
1 parent de1cec4 commit f40d00b
Show file tree
Hide file tree
Showing 692 changed files with 96 additions and 26,654 deletions.
455 changes: 0 additions & 455 deletions app/(home)/icons.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions app/(home)/layout.tsx

This file was deleted.

70 changes: 0 additions & 70 deletions app/(home)/page.tsx

This file was deleted.

55 changes: 55 additions & 0 deletions app/[...path]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { permanentRedirect } from 'next/navigation';
import { Metadata } from 'next';

type RedirectMap = {
[key: string]: string;
};

const staticRedirects: RedirectMap = {
'/course/subnet-architecture': '/academy/multi-chain-architecture',
'/course/teleporter': '/academy/interchain-messaging',
'/start': '/',
};

function getDestinationUrl(currentPath: string): string {
if (currentPath in staticRedirects) {
return `https://developers.avax.network${staticRedirects[currentPath]}`;
}

if (currentPath.startsWith('/course/')) {
const newPath = currentPath.replace('/course/', '/academy/');
return `https://developers.avax.network${newPath}`;
}

const cleanPath = currentPath.startsWith('/') ? currentPath.slice(1) : currentPath;
return `https://developers.avax.network/${cleanPath}`;
}

export async function generateMetadata({
params
}: {
params: { path: string[] }
}): Promise<Metadata> {
const currentPath = `/${params.path.join('/')}`;
const destinationUrl = getDestinationUrl(currentPath);

return {
robots: {
index: false,
follow: true
},
alternates: {
canonical: destinationUrl
}
};
}

export default function CatchAllRoute({
params,
}: {
params: { path: string[] };
}) {
const currentPath = `/${params.path.join('/')}`;
const destinationUrl = getDestinationUrl(currentPath);
permanentRedirect(destinationUrl);
}
54 changes: 0 additions & 54 deletions app/api/generate-certificate/route.ts

This file was deleted.

Binary file removed app/api/og/course/[slug]/inter-bold.woff
Binary file not shown.
106 changes: 0 additions & 106 deletions app/api/og/course/[slug]/route.tsx

This file was deleted.

Binary file removed app/api/og/guide/[slug]/inter-bold.woff
Binary file not shown.
100 changes: 0 additions & 100 deletions app/api/og/guide/[slug]/route.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions app/api/search/route.ts

This file was deleted.

15 changes: 0 additions & 15 deletions app/contribute/layout.tsx

This file was deleted.

51 changes: 0 additions & 51 deletions app/contribute/page.tsx

This file was deleted.

Loading

0 comments on commit f40d00b

Please sign in to comment.