fix: slug
This commit is contained in:
parent
0f902edc1b
commit
3e05a9df82
1 changed files with 3 additions and 3 deletions
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue