structured data with Next.js and DatoCMS

We use for rich snippets on Google throughout our website, mainly FAQs, product reviews, and video. Now that we are migrating website to DatoCMS and NextJS, I need to take this into account as well.

Does anyone have any suggestions for handling/serving structured data from DatoCMS to NextJS pages?

I am planning to building two models in DatoCMS:

  • FAQ for handling FAQs data for
  • Reviews for handling product reviews
  • In the product and page model I would have relational links to the above FAQ and Reviews models

Some of my basic questions:

  1. Is it best to save Json-ld in the DatoCMS models and insert that directly to Header in Next.JS? Or would you advice to generate code directly in Next.JS and just fetch content and properties from DatoCMS?

  2. Any recommendation on NexJS or React package to handle on page? Maybe GitHub - garmeeh/next-seo: Next SEO is a plug in that makes managing your SEO easier in Next.js pr?

Thanks on the input.


1 Like

No-one is using on the website :slight_smile: ?

I’m starting this now and my plan is to fetch the data from DatoCMS and generate the code in NextJS. Next SEO looks pretty good. What did you end up choosing?

Hey @tgregoirewright … haven’t yet come to this implementation, so I do not have any good suggestion for this. If you find something, please update here so we can follow.

1 Like

Hi @primoz.rome, I’ve started work on the structured data part of my site. So far the next-seo package has been useful. A couple notes from my limited experience so far:

  • It doesn’t have components for all of the valid Structured Data types, so if you’re lacking one you’ll have to roll your own or make a PR on the project. Looks like it has the common ones though.
  • For some properties I initially tried pulling them from DatoCMS’s built-in _seoMetaTags but that was annoying so I added the properties I needed into my queries directly (e.g. description).

next-seo is straightforward and I’ll probably use it for the other types of structured data I’ll be adding.