Skip to content

Commit 0434e08

Browse files
Merge pull request #35 from hirushaC/enhancement/site-improvements
Add redirect from root to /docs page
2 parents b959297 + 4f59836 commit 0434e08

File tree

1 file changed

+9
-37
lines changed

1 file changed

+9
-37
lines changed

pages/index.js

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,10 @@
1-
import CardContainer from "@/components/CardContainer";
2-
import FAQSection from "@/components/FAQSection";
3-
import FeatureArticles from "@/components/FeaturedArticles";
4-
import Hero from "@/components/Hero";
5-
import Wrapper from "@/components/Wrapper";
6-
import { postQuery } from "@/lib/queries";
7-
import { client, isSanityConfigured } from "@/lib/sanityClient";
8-
9-
export default function HomePage({ articles }) {
10-
11-
return (
12-
<Wrapper>
13-
<Hero />
14-
<CardContainer />
15-
<FAQSection />
16-
{isSanityConfigured && <FeatureArticles articles={articles} />}
17-
</Wrapper>
18-
);
19-
}
20-
21-
export async function getStaticProps() {
22-
let articles = null;
23-
24-
if (isSanityConfigured && client) {
25-
try {
26-
articles = await client.fetch(postQuery);
27-
} catch (error) {
28-
console.error("Error fetching articles from Sanity:", error);
29-
articles = null;
30-
}
31-
}
32-
33-
return {
34-
props: {
35-
articles,
36-
},
37-
};
1+
import { useEffect } from "react";
2+
import { useRouter } from "next/router";
3+
4+
export default function Home() {
5+
const router = useRouter();
6+
useEffect(() => {
7+
router.replace("/docs");
8+
}, [router]);
9+
return null;
3810
}

0 commit comments

Comments
 (0)