Lately I was often asked about what is the best way to create a modern website today. The answer is manyfold and maybe there is not one correct answer. As a computer scientist I also tend to answer (like most scientists do): “it depends”. But I observe a trend with contemporary websites: they combine a headless CMS with static site generation. This gives you the ease of use and dynamics of a CMS but at the performance of static sites.
Thus static site generation is still a valid solution to performance issues and used in the right way, definitely something one should take a look at – maybe this is something I will use in the future aswell for this blog.
I have spoken to Henrik Wirth – co-founder of the NeverNull startup and Gatsby enthusiast. Here is what he recommends (see the links below). But first some background for everyone who is interested in more details:
What is a headles CMS?
A headless CMS is a back-end only content management system (CMS). Its purpose is to serve content and make it accessible via an API (e.g. REST or GraphQL). Actually most “normal” CMS can also be used headles (e.g. WordPress) but there are also specialized CMS (e.g. Directus) that work “headless-only”.
What is a Static Site Generator?
A Static Site Generator (SSG) is a framework or setup, that helps you to generate static websites (HTML/CSS/JS). The source of your data can be anything from local files (e.g. text files or markdown) to APIs (e.g. REST, GraphQL). There are many static site generators written in all major languages out there (e.g. Nanoc, Hugo, Gatsby) supporting many different input sources such as markdown, xml or – as in this case – input via an API.
Why Gatsby and WordPress?
Henrik Wirth collected some information on pros and cons and also created a nice tutorial that explains how to get started with Gatsby and WordPress as CMS for your next cool website project. Check out the collected infos here.
Here you can find the tutorial: “Guide to Gatsby WordPress Starter Advanced with Previews, i18n and more by Henrik Wirth.”