Skip to content

Commit

Permalink
feat: add index.tsx
Browse files Browse the repository at this point in the history
This time should have been resolved #39
  • Loading branch information
turtton committed Mar 29, 2023
1 parent de993f6 commit 772cb1b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
9 changes: 0 additions & 9 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,4 @@ module.exports = {
return config;
},
output: "standalone",
async redirects() {
return [
{
source: "/",
destination: "/README",
permanent: true,
},
];
},
};
4 changes: 0 additions & 4 deletions src/pages/[...id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ export async function getStaticPaths(): Promise<{
const paths = slugs.map((p) => ({
params: { id: p.replace("/", "").split("/") },
}));
paths.push({ params: { id: ["index"] } });
return {
paths,
fallback: false,
Expand All @@ -153,9 +152,6 @@ export async function getStaticProps({
const [cacheData, rawTreeData] = await getCacheData();
const tree: TreeData = JSON.parse(rawTreeData);
let slugString = `/${params.id.join("/")}`;
if (slugString === "/index") {
slugString = `/${FIRST_PAGE()}`;
}
const fileName = toFileName(slugString, cacheData);
const filePath = toFilePath(slugString, cacheData);
const markdownContent = isMediaFile(fileName) ? "" : readFileSync(filePath);
Expand Down
12 changes: 12 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Home, {
FIRST_PAGE,
getStaticProps as getDefaultStaticProps,
Prop,
} from "./[...id]";

export const Index = (prop: Prop) => Home(prop);

export const getStaticProps = async () =>
getDefaultStaticProps({ params: { id: [FIRST_PAGE()] } });

export default Index;

0 comments on commit 772cb1b

Please sign in to comment.