Static Websites with Headless WordPress via REST API

Static websites are great but they still need some kind of content management system. And committing Markdown files to GitHub isn’t a friendly option for the majority of users including developers. So we end up using tools such as Prose, Netlify CMS or Contentful for the editing interface, user authentication and handling the media files.

Usually it is only the WordPress PHP templating layer that bothers the proponents of static websites and is perceived as the performance bottleneck. However, we now have the WordPress REST API which is way more flexible than any collection of Markdown files.

How?

  1. Use WordPress REST API during the build process to create the content source files with the necessary front-matter.
  2. Use Jekyll, Hugo, Metalsmith, GatsbyAssemble or any other build tool to actually construct the website.

There is even a WordPress REST API client library for Node.js which simplifies everything for Node based workflows and deployment setups.

Finally, a free website on WordPress.com can be used as a content library.

Leave a Reply