Create a component called [[..zesty]].tsx in your pages directory
Here is an example snippet for the catch all component. Note that we are using Material UI components in this example which are not necessary for your custom build. You will want to setup a <ZestyView> component that passes the content property.
import React from"react";import { GetServerSideProps } from"next";import { fetchPageJson } from"@zesty-io/nextjs-sync";import { ZestyView } from"@/components/zesty/ZestyView";// main is used here, its a base for layout that uses Material UI (mui), delete it if you dont want it, and just return <ZestyView content={props} />
import Main from"@/layout/Main";import { ContentItem } from"@/types";exportdefaultfunctionZesty(props:ContentItem) {return (<Main><ZestyViewcontent={props} /></Main>);}// This gets called on every request, its for SSR mode in nextexportconstgetServerSideProps:GetServerSideProps=async (ctx) => {try {constdata=awaitfetchPageJson(ctx.resolvedUrl);// add your own custom logic here if needed, set your data to {data.yourData} ...// generate a status 404 pageif (data.error) return { notFound:true };// Pass data to the page via propsreturn { props: data };} catch (error) {// handle unexpected errorsconsole.error(error);return { notFound:true };}};