How to change the MapleCMS default nextjs app from static to dynamic

14 Views Asked by At

I created a Maple CMS (https://maplecms.ai) schema, content and then downloaded their built-in Nextjs example. That was really simple and I was impressed.

I noticed the app generated uses the content in a static way - that is SSG (Static site generation) and I would like it to be more SSR

export async function getStaticProps() {
const mapleClient = new MapleClient()

// TODO: this query fetches all entries in order of created_at. This is a technical field managed by the Maple CMS system.
// You will probably want to change this to a field that you can control and make sense for your use case.
const entries = (await mapleClient.getAll_blog_post( {
    orderBy: {
        field: "created_at",
        direction: "DESC"
    }
} ))

return {
    props: { entries },
};

Either way, really liked this example with all the todos - really makes sense and saved me a ton of time compared to other solutions I tried in the past (like Hygraph or Contentful). Just not sure how I can change it to not be static code generation but rather just server-side rendering, and for the API to be fetched not at build-time but for every user that reloads the page.

Thanks

0

There are 0 best solutions below