Skip to content

Commit

Permalink
feat: redirect to old document if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
himself65 committed Oct 25, 2024
1 parent 2c7c3ea commit 2463ae3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/next/src/app/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Feature } from "@/components/feature";
import { NpmInstall } from "@/components/npm-install";
import { TextEffect } from "@/components/text-effect";
import { Button } from "@/components/ui/button";
import { DOCUMENT_URL } from "@/lib/const";
import { SiStackblitz } from "@icons-pack/react-simple-icons";
import { Bot, Terminal } from "lucide-react";
import Link from "next/link";
Expand All @@ -26,7 +27,7 @@ export default function HomePage() {
</div>

<div className="flex flex-wrap justify-center gap-4">
<Link href="/docs/llamaindex">
<Link href={DOCUMENT_URL}>
<Button variant="outline">Get Started</Button>
</Link>
<NpmInstall />
Expand Down
11 changes: 11 additions & 0 deletions apps/next/src/app/[...any]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { DOCUMENT_URL } from "@/lib/const";
import { redirect } from "next/navigation";

export default async function Page(props: {
params: Promise<{
any: string[];
}>;
}) {
const path = await props.params.then(({ any }) => any.join("/"));
return redirect(new URL(path, DOCUMENT_URL).toString());
}
2 changes: 2 additions & 0 deletions apps/next/src/lib/const.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// when we are ready, change to /docs/llamaindex
export const DOCUMENT_URL = 'https://old.ts.llamaindex.ai/'

0 comments on commit 2463ae3

Please sign in to comment.