Skip to content

Commit 9d7ba28

Browse files
fixed
1 parent dea526f commit 9d7ba28

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/app/[year]/[month]/[aid]/page.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { getArticleIndexes, toHTML } from "../../../article/article";
22
import { notFound } from "next/navigation";
33
import Image from "next/image";
44
import Link from "next/link";
5-
import "./page.css"; // 必要に応じてCSSをインポート
5+
import "./page.css";
66

77
export async function generateStaticParams() {
88
const indexes = getArticleIndexes();
@@ -17,13 +17,16 @@ export async function generateStaticParams() {
1717
export default async function ArticlePage({
1818
params,
1919
}: {
20-
params: { year: string; month: string; aid: string };
20+
params: Promise<{ year: string; month: string; aid: string }>;
2121
}) {
22+
// 非同期でparamsを解決
23+
const resolvedParams = await params;
24+
2225
const indexes = getArticleIndexes();
2326
const articles = await toHTML(indexes);
2427

2528
// スラッグに一致する記事を探す
26-
const slug = `${await params.year}/${await params.month}/${await params.aid}`;
29+
const slug = `${resolvedParams.year}/${resolvedParams.month}/${resolvedParams.aid}`;
2730
const article = articles.find((a) => a.slug === slug);
2831

2932
if (!article) {

0 commit comments

Comments
 (0)