fix: slug

This commit is contained in:
Benno Tielen 2026-04-09 12:00:08 +02:00
parent 0f902edc1b
commit 3e05a9df82

View file

@ -9,12 +9,12 @@ import { RefreshRouteOnSave } from '@/components/RefreshRouteOnSave/RefreshRoute
import { draftMode } from 'next/headers' import { draftMode } from 'next/headers'
type Props = { type Props = {
params: Promise<{ slug?: string }> params: Promise<{ slug?: string[] }>
} }
export async function generateMetadata({ params }: Props): Promise<Metadata> { export async function generateMetadata({ params }: Props): Promise<Metadata> {
const slug = (await params).slug const slug = (await params).slug
const page = await fetchPageBySlug(slug || "") const page = await fetchPageBySlug(slug?.join('/') || "")
if (!page) return {} if (!page) return {}
@ -27,7 +27,7 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
export default async function DynamicPage({ params }: Props) { export default async function DynamicPage({ params }: Props) {
const slug = (await params).slug const slug = (await params).slug
const { isEnabled: isDraft } = await draftMode() const { isEnabled: isDraft } = await draftMode()
const page = await fetchPageBySlug(slug || "", isDraft) const page = await fetchPageBySlug(slug?.join('/') || "", isDraft)
const authenticated = await isAuthenticated() const authenticated = await isAuthenticated()
if (!page) { if (!page) {