Skip to content

Commit

Permalink
fix: move getStaticPaths at the top of blog page
Browse files Browse the repository at this point in the history
  • Loading branch information
ixartz committed Nov 19, 2022
1 parent f4a55c4 commit 83892ea
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/pages/blog/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ type IBlogUrl = {
slug: string;
};

export const getStaticPaths: GetStaticPaths<IBlogUrl> = async () => {
return {
paths: [...Array(10)].map((_, index) => ({
params: { slug: `blog-${index}` },
})),
fallback: false,
};
};

export const getStaticProps: GetStaticProps<IBlogUrl, IBlogUrl> = async ({
params,
}) => {
Expand All @@ -35,13 +44,4 @@ const Blog = (props: InferGetStaticPropsType<typeof getStaticProps>) => {
);
};

export const getStaticPaths: GetStaticPaths<IBlogUrl> = async () => {
return {
paths: [...Array(10)].map((_, index) => ({
params: { slug: `blog-${index}` },
})),
fallback: false,
};
};

export default Blog;

0 comments on commit 83892ea

Please sign in to comment.