Thanks for your help! Im new to this….
Im using Next 15.5.4 with the App router and I have route structure like:
[lang]
uid → page.tsx
aanbouwdelen - page.tsx → category - page.tsx → [uid] - page.tsx
nieuws → [uid] → page.tsx
Next.config.ts:
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
i18n: {
locales: ["nl", "en"],
defaultLocale: "nl",
},
};
export default nextConfig;
Prismicio.ts:
Prismicio.ts: import {
createClient as baseCreateClient,
type ClientConfig,
type Route
} from "@prismicio/client";
import { enableAutoPreviews } from "@prismicio/next";
import sm from "../slicemachine.config.json";
export const repositoryName = sm.repositoryName;
const routes: Route[] = [
{ type: "home", path: "/:lang?/" },
{ type: "page", path: "/:lang?/:uid" },
{ type: "nieuws", path: "/:lang?/:uid" },
{ type: "vacatures", path: "/:lang?/:uid" },
{ type: "nieuws_item", path: "/:lang?/nieuws/:uid" },
{ type: "vacature_item", path: "/:lang?/vacatures/:uid" },
{ type: "aanbouwdelen", path: "/:lang?/aanbouwdelen" },
{ type: "category", path: "/:lang?/aanbouwdelen/:uid" },
{
type: "product",
path: "/:lang?/aanbouwdelen/:category/:uid",
resolvers: { category: "category" },
},
];
export function createClient(config: ClientConfig = {}) {
const client = baseCreateClient(repositoryName, {
routes,
fetchOptions:
process.env.NODE_ENV === "production"
? {
next: { tags: ["prismic"] },
cache: "force-cache",
}
: {
next: { revalidate: 5 },
},
...config,
});
enableAutoPreviews({ client });
return client;
}
- A snippet showing how you generate links/navigation? Im using the Primsic Link snippet
<nav className="flex justify-end py-2">
<div className="flex justify-end w-fit">
<ul className="flex justify-between w-full uppercase font-medium">
{nav?.data?.upperlinkrow?.map((item, index) => (
<li key={index} className="text-primary hover:text-secondary text-primary-400 p-2 border-t border-gray-200">
<div className="flex justify-between items-center">
<PrismicNextLink field={item.link} />
</div>
</li>
))}
</ul>
</div>
</nav>