We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e35517b commit 28b5f0eCopy full SHA for 28b5f0e
src/app/news/[slug]/page.tsx
@@ -12,10 +12,12 @@ interface Props {
12
searchParams: {};
13
}
14
15
-export async function generateStaticParams() {
+// newsの中身が無かった場合の処理
16
+export async function getStaticPaths() {
17
const docsDirectory = path.join(process.cwd(), `docs`, `news`);
18
const docs = await fs.readdir(docsDirectory);
- return docs.map((doc) => ({ slug: doc.replace(/\.md$/, '') }));
19
+ const paths = docs.map((doc) => ({ params: { slug: doc.replace(/\.md$/, '') } }));
20
+ return { paths, fallback: false };
21
22
23
export async function generateMetadata({ params }: Props): Promise<Metadata> {
0 commit comments