I’m trying to build an application with NextJS and DatoCMS, the idea is to have a highly customizable website with a couple a components. A editor in DatoCMS can add a page, add some components with custom content and build the website that way.
I’m using the AppRouter of NextJS, and my folder structure is currently looking like this:
- src
- app
- [slug]
- app
Which works fine for every page like /slug
but for the homepage I can’t seem to do it.
In DatoCMS the idea would be for the editor to put a custom slug, currently it’s set to _
.
I didn’t want to make a special place for the homepage in DatoCMS, I’d like it to be just a normal page like all the others.
I deleted the page.js
in the root and in src/app/[slug]/page.jsx
I have this
export const dynamicParams = false
export async function generateStaticParams() {
const { allPages } = await performRequest(PAGE_CONTENT_QUERY);
return allPages.map((pages) => ({
slug: pages.slug == "_" ? "" : pages.slug,
}))
}
But I guess when I add the “” it tries to go to the page.js that I deleted.