11import { notFound } from "next/navigation" ;
2- import { allDocs } from "contentlayer/generated " ;
2+ import { allDocs } from "content-collections " ;
33
44import { getTableOfContents } from "@/lib/toc" ;
55import { Mdx } from "@/components/content/mdx-components" ;
@@ -20,7 +20,8 @@ interface DocPageProps {
2020}
2121
2222async function getDocFromParams ( params ) {
23- const slug = params . slug ?. join ( "/" ) || "" ;
23+ const slug = params . slug ?. join ( "/" ) || "index" ;
24+
2425 const doc = allDocs . find ( ( doc ) => doc . slugAsParams === slug ) ;
2526
2627 if ( ! doc ) return null ;
@@ -58,11 +59,12 @@ export default async function DocPage({ params }: DocPageProps) {
5859 notFound ( ) ;
5960 }
6061
61- const toc = await getTableOfContents ( doc . body . raw ) ;
62+ const toc = await getTableOfContents ( doc . content ) ;
6263
6364 const images = await Promise . all (
6465 doc . images . map ( async ( src : string ) => ( {
6566 src,
67+ alt : "Image" ,
6668 blurDataURL : await getBlurDataURL ( src ) ,
6769 } ) ) ,
6870 ) ;
@@ -72,7 +74,7 @@ export default async function DocPage({ params }: DocPageProps) {
7274 < div className = "mx-auto w-full min-w-0" >
7375 < DocsPageHeader heading = { doc . title } text = { doc . description } />
7476 < div className = "pb-4 pt-11" >
75- < Mdx code = { doc . body . code } images = { images } />
77+ < Mdx code = { doc . body } images = { images } />
7678 </ div >
7779 < hr className = "my-4 md:my-6" />
7880 < DocsPager doc = { doc } />
0 commit comments