AGILEDROP: A Short Introduction to Headless Drupal

Parent Feed: 

It is a well-known fact by now that Drupal is a very flexible and an extremely agile CMS. Even though it is arguably the most customizable CMS of all, the awesome people behind Drupal aren’t just resting on their laurels due to this. If you’ve been keeping up with any Drupal news or in fact CMS news at all, you might have heard of the term ‘headless’. While the term might sound very odd, it defines something really awesome. So let’s take a look at what headless Drupal is in this post and why it’s so great.

 

Difference Between Headless and ‘Normal’ Drupal

When you run a default Drupal installation you are greeted by a premade theme. By default, the front-end, services and the back-end are all controlled by Drupal itself. This means that the theme you see, the way the site works as well as all the content, media, images etc you store are all done through Drupal itself.

The concept of ‘headless’ aims to separate the front-end i.e the way the site is displayed from Drupal. What this essentially means is that all the services and the content management are handled by Drupal while the core user experience or the way the site is displayed in a browser is controlled via a javascript framework such as React.js or backbone.js. This is achieved via Drupal’s RESTful API service. Headless Drupal can also be known as a way of using Drupal as a service where the content management and the logic of the site are provided by Drupal and the front-end is done via a javascript framework of choice. Here is an excellent representation of Headless Drupal in a visual format from Pantheon:

Headless Drupal

How Difficult is it to Implement Headless Drupal

Going the way of Headless Drupal with Drupal 7 required installation of 3rd party modules such as Services or RestWS.

With Drupal 8 though, RESTful services have been implemented into the core.
Drupal uses JSON, one of the most widely adopted API formats, for its web services. To implement Headless Drupal, knowledge of JSON and how it works is definitely a must. One must also know how Drupal utilizes RESTful web services as well. Generally speaking though, anyone familiar with Drupal development wouldn’t find it too difficult to implement headless Drupal.

 

Why Headless Drupal

There are multiple reasons for aiming to achieve this; some of them are:

  1. Making the site future proof. If in future there is a need to redesign a site, there won’t be any need of going through the hassle of redesigning the back-end and setting up services again. Since the logic of the website and the content management is handled by Drupal, redesigning a site visually would only require tinkering with the front-end.
  2. It completely frees up the front-end team to work on the way the site looks, in-turn freeing up the back-end team to handle the site’s backend architecture.
  3. It helps to speed up the site. Javascript frameworks like React.js are known for their speed and ease of use. Using such framework to deliver content to the user eliminate a lot of the limitations of Drupal’s own front-end architecture. Also, since these frameworks only have to deliver API calls from Drupal to HTML; the entire site gets faster since they need to adhere to complex logics set by Drupal and can only focus on content delivery itself.
  4. The websites that use headless Drupal are much more responsive than ones using Drupal’s native front-end. It has become almost a necessity for a site to be responsive due to the immense rise of mobile devices. Thanks to headless Drupal, this is well addressed.

Conclusion

Headless Drupal (headless websites, for that matter) are all the rage now whenever the future of the web is discussed. Where CMSs aimed to simplify management of a website’s content, this concept takes it a step further by aiming to simplify the front-end as well. Headless Drupal enables creating sites that are much faster, responsive and capable of delivering rich user experience.


We believe in keeping up with the trends and being ready for the future, there is always great value in that and that is what we aim to provide our clients. We understand going down the ‘headless’ Drupal route might come off as a bit intimidating, so feel free to get in touch with us if you wish to future-proof your own Drupal site by of course making it - ‘Headless’!

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web