Skip to content

Commit

Permalink
デプロイ失敗するから再度作成
Browse files Browse the repository at this point in the history
  • Loading branch information
batora9 committed Apr 6, 2024
1 parent ee53de0 commit 5c9b87e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 10 additions & 0 deletions docs/news/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "テスト"
createdAt: "2024-03-10"
updatedAt: "2024-03-10"
description: "説明欄"
group: "Maximum"
---

デプロイの関係上、仮のファイルを作らないと通らないため作りました。
記事作成される方はこのファイルは削除してください。
6 changes: 1 addition & 5 deletions src/app/news/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@ interface Props {
searchParams: {};
}

// newsの中身が無かった場合の処理
export async function generateStaticParams() {
const docsDirectory = path.join(process.cwd(), `docs`, `news`);
const docs = await fs.readdir(docsDirectory);
const paths = docs.map((doc) => ({
params: { slug: doc.replace(/\.md$/, '') },
}));
return { paths, fallback: false };
return docs.map((doc) => ({ slug: doc.replace(/\.md$/, '') }));
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
Expand Down

0 comments on commit 5c9b87e

Please sign in to comment.