"@prismicio/client": "^7.21.0",
"next": "^16.0.7",
I want the URL structure:
/resources/:resource_type/:uid
My routes look like:
const routes: Route = [
{ type: "page", uid: "home", path: "/" },
{ type: "page", path: "/:uid" },
{ type: "resource_type", path: "/resources/:resource_type" },
{
type: "resource",
resolvers: { resource_type: "resource_type" },
path: "/resources/:resource_type/:uid"
}
];
My folder structure looks like:
—page.tsx
—[uid]
——page.tsx
—resources
——[resource_type]
————page.tsx
————[uid]
——————page.tsx
//resources/[resource_type]/page.tsx
import { createClient } from "@/prismicio";
type Params = { resource_type: string };
export default async function ResourceTypePage({
params
}: {
params: Promise;
}) {
const { resource_type } = await params;
const client = createClient();
const doc = await client.getByUID("resource_type", resource_type);
return <>{doc.data.title}</>;
}
//resources/[resource_type]/[uid]/page.tsx
import { createClient } from "@/prismicio";
type Params = { uid: string };
export default async function ResourcePage({
params
}: {
params: Promise;
}) {
const { uid } = await params;
const client = createClient();
const doc = await client.getByUID("resource", uid);
return <>{doc.data.title}</>;
}
Accessing:
localhost:3000/resources/talks
localhost:3000/resources/talks/talk-one
gives the error:
[Link resolver error] The following resolvers are missing for page type resource_type:
resource
[Link resolver error] The following resolvers are missing for page type resource:resource
src/app/resources/[resource_type]/page.tsx (12:14) @ ResourceTypePage10 | const { resource_type } = await params;
11 | const client = createClient();12 | const doc = await client.getByUID("resource_type", resource_type);
| ^
13 |
14 | return <>{doc.data.title}</>;
15 | }
Page type: Resource
has content relationship field linking it to
Page type: Resource Type
How do I fix it?!