- Nov 25, 2020
- by A2 CMS Team
To attract the widest possible audience, you’ll need to post across multiple online platforms. However, crafting and publishing content for different operating systems can be a time-consuming and frustrating process.
What’s more, if your content isn’t accessible on any type of device, then you risk losing out on potential visitors. Fortunately, by using a headless Content Management System (CMS), you can create your content once and then publish it across multiple operating systems, including Android and iOS.
In this post, we’ll explore what makes a CMS headless, and the reasons you may want to choose that kind of platform. Let’s get started!
What Is a Headless Content Management System (CMS)?
A Content Management System (CMS) has a front end (the head) and a back end (the body). To convert a traditional CMS into a headless CMS, you separate the two ends. The ‘head’ refers to where the content ends up, and the ‘body’ is where that content is stored and authored.
A headless CMS tends to take the form of a database back end with a web-based User Interface (UI) as the front end. You’ll use the UI to create your content, and the database to store and manage all of the supporting data.
A headless CMS doesn’t care how or where your content is displayed. Instead of coupling your content to a specific output, such as a web page, it provides your content as data using a RESTful Application Programming Interface (API). To access a post, you’ll send the headless CMS a network request to an API endpoint.
You can host a headless CMS on your own server and database. However, this requires you to perform your own scaling and operations. In most cases, it’s simpler (and cheaper) to host your headless CMS using a web hosting provider.
The opposite of a headless CMS is a traditional or ‘monolithic’ CMS. This is software that you either install and manage yourself, or access via a managed environment. While a headless CMS only provides the back end required to store and manage your content, a traditional CMS provides a way to display that content as well.
Of course, some platforms can do double duty. For example, WordPress is typically considered a traditional CMS. However, WordPress has a REST API built in, which makes it a popular choice for converting into a headless CMS.
5 Benefits of Using a Headless CMS
There are many benefits to opting for a headless rather than a monolithic CMS. Let’s look at five of the key advantages.
1. You Can Push Content to Multiple Platforms
Modern web content should be accessible across multiple platforms. A headless CMS removes the presentation layer from your content, which makes it platform-independent.
When you need to deliver the same content across various channels, a headless CMS can save you a significant amount of time. For example, you can make API calls to a headless CMS and push the same content to both iOS and Android. This is often much easier than developing and maintaining two separate sets of content.
2. Choose Your Preferred Technology and Tooling
A headless CMS enables you to take a developer-first approach, rather than focusing on how the back end will feed to the front end. Since headless content is served over APIs, you can build your website using the technology of your choice, including your preferred front-end tooling. You can also define how data is stored and managed in the back end.
Since you don’t have to learn technology that’s specific to your chosen CMS, a headless platform can save you a significant amount of time. As your project evolves, you can interchange parts of your technology stack, or move from one framework to the other without having to start from scratch. This gives you the freedom to continuously revise and improve your approach, based on the changing needs of your project.
3. Greater Freedom to Display Your Content
Since you’re not tightly tied to any particular themes, plugins, or even a specific platform, you have more control over your content’s appearance. Even if you develop custom software such as bespoke themes and plugins, you’re often restricted by your CMS’ front end.
By opting for a headless CMS, you have greater freedom to store, develop, and present your content. This includes showcasing your content in ways that traditional CMSs such as WordPress aren’t designed to support, even with the help of themes and plugins.
4. Protect Your Content Against Attackers
Headless content is separated from the presentation layer, which means that it has a smaller attack surface. In particular, a headless CMS doesn’t have a native content publishing solution, so the chances of a Denial-of-Service (DDoS) attack are reduced.
Since your content exists separately from your front-end delivery, it also isn’t as vulnerable to third-party application issues. This includes security vulnerabilities and bugs that are sometimes present in pre-existing technology stacks.
5. Get a Performance Boost
Traditional CMS architectures have to spend resources on content editing and rendering. By contrast, a headless CMS consists of a content database and API calls. This can significantly reduce your overhead costs and cloud storage bills.
When used as a headless CMS, WordPress only requires a simple MySQL and PHP stack, making it a lightweight and high-performing option. In other words, headless architecture is a great way to speed up your websites and applications.
Potential Issues With Headless CMSs
For all the benefits on offer, there are some potential drawbacks. Headless CMSs don’t offer a ‘What You See Is What You Get’ (WYSIWYG) editor or a live preview option, which can make it difficult to predict how your content will appear when rendered.
Headless CMSs also typically require more maintenance, particularly in terms of updates and security. They can also require different credentialing, and may benefit from advanced libraries and front-end programming expertise. For these reasons, headless CMSs can be challenging for users who don’t have extensive content management and programming experience.
Using WordPress as a Headless CMS (2 Methods)
If you’ve weighed up the pros and cons and decided to give headless a try, WordPress is a great platform to get started with. Here are two ways to set up WordPress as a headless CMS.
Method 1: Create a Blank Theme
The front end may have little role to play in a headless CMS, but WordPress does still require a theme to run. The easiest option is to create a blank theme, using the following files:
- index.php. This will redirect users to your website’s static home page. The file will preserve the back end, and remove the front end of your CMS.
- style.css. This should contain some basic information about your theme, including the theme’s name and the author’s name.
To create your index.php file, you’ll use the following format:
window.location = 'http://example.com';
To create the style.css file, use this format:
Theme Name: blank
You can then place these two files in your wp-content/themes/blank directory, and activate the theme in the WordPress admin area.
Method 2: Use a Plugin
Alternatively, you can create a headless WordPress installation using a plugin. While this diminishes your flexibility a bit, it’s also a faster and simpler option.
There are a few tools you can try, but we’d recommend getting started with WP Headless CMS Framework:
This solution provides multiple framework options, and is highly-configurable thanks to a collection of modules that can be activated and deactivated at will. The plugin also comes with its own comprehensive documentation, which should get you up and running quickly.
In today’s multi-device world, it’s often not enough to publish your content to a single place. Creating content for multiple platforms can be a time-consuming process, but a headless CMS enables you to do this far more quickly and effectively.
To set up WordPress as a headless CMS, you can either:
- Create a blank theme.
- Use a plugin, such as WP Headless CMS Framework.
Going headless doesn’t eliminate the need for secure, reliable hosting! Regardless of whether you opt for a traditional or a headless CMS, make sure you choose the right hosting provider.
Image credit: Philipp Birmes.