Querying TinaCMS Content in Nextjs

Querying TinaCMS Content in NextJS

In NextJS, content can be queried statically at build-time or dynamically at runtime (using SSR, or CSR).

Fetching content for static pages

Example: Fetching content through getStaticProps

Example: Fetching content through getStaticPaths

You'll likely want to query the TinaCMS's Content API for dynamic routes.

Next.js fallback: "blocking"

In Next.js one can specify fallback: "blocking", this allows getStaticProps to run server-side at request time when a user goes to a page that was not specified in getStaticPaths. This allows document-creation to work with TinaCMS, as well as advanced NextJS features like ISR.

For a full working example of TinaCMS + NextJS, check out our "React Starter".

Fetching content for SSR pages

Example: Fetching content through getServerSideProps