How to setup and deploy a headless blog in 5 minutes
Mon — 25 May, 2020

We will just jump straight in, we just want to launch our blog!


Firstly you need an endpoint for your blog, we’ll step straight in and offer this for you, so setup your headless WordPress hosting with TreacleWP. No it’s not a laborious process, start to finish will be within the 5 minutes total!

Once done, and created an install, it’ll be setup in a few minutes but you’ll have your endpoint instantly, so we can jump into the code while the install is provisioning.


We’ll work with NuxtJS for this example, but we are not precious on your framework of choice.

$ npx create-nuxt-app <PROJECT_NAME>

Go through the options, and open up your favourite editor. Remember to tick axios while installing.

Create a folder in /pages of your blog base, we’ll use /blog.

$ cd <PROJECT_NAME>/pages
$ mkdir blog && cd blog
$ touch _slug.vue index.vue

Now create 2 pages, within this, 1 for your single page and one for your index page. So your structure should look like the below:


Within index, we’ll add a simple fetch and then loop.

// Page: index.vue
        <article v-for="post in posts">
            <h2>{{ post.title.rendered }}</h2>
            <div v-html="post.excerpt.rendered"></div>
            <nuxt-link :to="`/blog/${post.slug}`">Read More</nuxt-link>

import axios from 'axios'
export default {
    asyncData ({ params }) {
        return axios.get(`http://<INSTALL_NAME>`)
        .then((res) => {
            return { posts: }

Great, we are now looping through and have an index page with posts, title, excerpt and link to read more.

Now it’s time to create your single page.

// Page: _slug.vue
        <div v-html="post.content.rendered"></div>

import axios from 'axios'
export default {
    asyncData ({ params }) {
        return axios.get(`https://<INSTALL_NAME>${params.slug}`)
        .then((res) => {
            return { post:[0] }

And you’re done, you have a working blog, albeit basic, now to get it live.


Depending which setup you used with NuxtJS, the default being SSR (Server Side Rendered), you will need to generate your production code.

But before you do this, you may have to tell NuxtJS what blog routes to output into production code. We can do this by opening nuxt.config.js in the root and adding:

import axios from 'axios'

To the top before export default {}

Then within the export default object add in the following:

generate: {
    routes ( callback ) {
            axios.get( `http://<INSTALL_NAME>` )
        .then( axios.spread( posts => {

            const postsRoute = post => {
                return `/blog/${post.slug}`

            callback( null, postsRoute );

        }), error => {
            return next( error );


Your now good to run your production code.

$ npm run generate
// OR
$ yarn generate

You can use any service you wish to deploy, but we love Netlify, so setup an account, and simply drag and drop your newly generated dist folder into Netlify.

Navigate to https://<YOUR_SITE> to see your new blog

We use GitHub to push to it, but drag and drop will be within the 5 minute target. For more information on deploying a Vue website, read this article

Now, this is a basic introduction, but it just goes to show how quickly you can get up and running with TreacleWP and headless WordPress.

In further blog posts we will go into bulking out the blog and adding pagination as well as getting that 100% lighthouse score!

Any issues, send us an email or send us a tweet.

Ready to get started?
WordPress has never been so easy to go headless with.
Get Started