By John, 20 July, 2020
GraphQL in Twig queries additional data from the backend

At Drupalcon Global, I gave a presentation talking about a 3rd way to tackle rendering content from a CMS. The two standard ways are:

  1. Rendering it all on the server with the CMS, where the data provided may not match the design requirements
  2. Creating an API (JSON:API or GraphQL) on the backend that serves the data to a frontend written in JavaScript. But now you need to handle all the form handling yourself.

The third way is rendering on the server, but query for the exact data you need with GraphQL inside the server's frontend Twig files.