From 34db365606e2c2937276f5b829287b6b00800975 Mon Sep 17 00:00:00 2001 From: Nicolas Froidure Date: Wed, 23 Aug 2023 14:59:32 +0200 Subject: [PATCH] fix(pages): fix slug page --- src/pages/[...slug].tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/[...slug].tsx b/src/pages/[...slug].tsx index ebf5549c..7de0d913 100644 --- a/src/pages/[...slug].tsx +++ b/src/pages/[...slug].tsx @@ -49,8 +49,9 @@ const Page = ({ entry }: Props) => { export default Page; export const getStaticPaths: GetStaticPaths = async () => { - const paths = (await readDir(pathJoin(".", "contents", "pages"))).map( - (path) => { + const paths = (await readDir(pathJoin(".", "contents", "pages"))) + .filter((file) => file !== "index.md") + .map((path) => { const slug = path.replace(".md", "").split("/"); if (slug[slug.length - 1] === "index") { @@ -60,8 +61,7 @@ export const getStaticPaths: GetStaticPaths = async () => { return { params: { slug }, }; - } - ); + }); return { paths, fallback: false }; };