When it comes to creating structured data for the content on your site, the best way to go about it nowadays, with one exception, is JSON-LD. Whilst RDFa and and microdata have also long been supported, JSON-LD is an official W3C recommendation, and Google's recommended method for annotating your pages.

From a develment perspective, it's also a more elegant solution, as it packs all the structured data relevant to a page into one nice, contained element. This makes it easier to debug if you have any issues, as you don't have to crawl through a page and check off attributes in your HTML for correctness.

As a rule, I'd highly recommend (assuming you're using a CMS), having JSON-LD generation as part of the CMS, rather than doing this every single time. However, if you need it, here it is. The challenge you might encounter with that though is that there are a lot of elements you might want to mark up, which a CMS may not naturally support. Common examples of this would include recipes, reviews, videos and so on.

For pages with those, if your CMS doesn't support structured data creation natively, you will want to create the whole JSON-LD markup separately, to ensure it's all correct.

General Reading

For futher details on structured data, I'd highly recommend reading the following pages from Google as a starter:

Useful Resources

I'd also give recommendations to the following...

Steal Our JSON-LD

A useful little site with examples of lots of JSON-LD implementations

Structured Data Testing Tool

Handy tool from Google which lets you test either live URLs or code snippets for implementation correctness.

JSON-LD Schema Generator

A schema.org JSON-LD generator. Useful for creating one-off pages.

If you've enjoyed this post, you might want to follow me on Twitter