Setting Up a Headless Website with Drupal 11, Next.js, and Layout Builder
The article, "Building a Headless Next.js Site with Drupal 11 and Layout Builder," by Kevin Quillen, published by Velir, explores how to set up a headless website using Drupal 11 as the backend CMS and Next.js for the frontend, hosted on Netlify. Drupal’s Layout Builder is leveraged for complex layouts and page structure editing, although it requires some patches to expose Layout Builder data via JSON. Key patches include exposing Layout Builder data to JSON and working with serialized PHP objects.
The article details the advantages of using Layout Builder for a headless architecture. Editors can drag and drop components, creating flexible layouts without the need for code. JSON is preferred over GraphQL due to its integration with Drupal core and clear specification.
Additionally, Netlify integration is covered for seamless builds and caching, allowing site editors to regenerate the site on demand. The piece emphasizes that this setup ensures a fast, flexible, and powerful decoupled site, combining the strengths of Drupal and Next.js.