File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/app/[year]/[month]/[aid] Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { getArticleIndexes, toHTML } from "../../../article/article";
22import { notFound } from "next/navigation" ;
33import Image from "next/image" ;
44import Link from "next/link" ;
5- import "./page.css" ; // 必要に応じてCSSをインポート
5+ import "./page.css" ;
66
77export async function generateStaticParams ( ) {
88 const indexes = getArticleIndexes ( ) ;
@@ -17,13 +17,16 @@ export async function generateStaticParams() {
1717export 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 ) {
You can’t perform that action at this time.
0 commit comments