VueJS Logo

Vue.js Blog Engine

You've got better things to do than build another blog

Add Butter to your Vue.js app and get back to more interesting problems

Try ButterCMS free

ButterCMS is an API-based Vue.js blog engine that integrates seamlessly with new and existing Vue.js apps. Add ButterCMS to your Vue.js app in minutes using our Node.js API client. Use ButterCMS with Vue.js to enable dynamic content in your apps for blogs, pages, and more.

Above is quick video of integrating Butter's blog engine into an application.

Butter's Blog API slides right into our apps and helps avoid having yet another WordPress site.

Daniel, Founder of Collective Idea

All your requirements, solved

  • ButterCMS Feature Image Use main domain (for SEO)
  • ButterCMS Feature Image Friendly admin interface
  • ButterCMS Feature Image Upload images and media
  • ButterCMS Feature Image Edit slugs and meta tags
  • ButterCMS Feature Image Tag and categorize posts
  • ButterCMS Feature Image RSS/Atom Feeds
  • ButterCMS Feature Image Search
  • ButterCMS Feature Image Webhooks

Powerful admin interface

Integrates with Vue.js

Our blog engine has a simple API and drop-in Vue.js SDK.

Save development time

Save thousands of dollars worth of development time with our easy setup.

Gives you great SEO

Host your blog on your main domain and customize slugs and meta tags.

Try ButterCMS in your Vue.js app

Setup in minutes

Official Vue.js Guide



Integrating Butter into your Vue.js app is dead simple. Here's a mini tutorial to get a feel for of setting up your blog home and blog post pages. For full a integration guide check out our Official Vue.js Guide

To display posts we create a simple /blog route in our app and fetch blog posts from the Butter API, as well as a /blog/:slug route to handle individual posts. See our API reference for additional options such as filtering by category or author. The response also includes some metadata we'll use for pagination.

See our API reference for additional options such as filtering by category or author. The response also includes some metadata we'll use for pagination.

router/index.js:

import Vue from 'vue'
import Router from 'vue-router'
import BlogHome from '@/components/BlogHome'
import BlogPost from '@/components/BlogPost'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/blog/',
      name: 'blog-home',
      component: BlogHome
    },
    {
      path: '/blog/:slug',
      name: 'blog-post',
      component: BlogPost
    }
  ]
})

Then create components/BlogHome.vue which will be your blog homepage that lists your most recent posts.

<script>
  import { butter } from '@/buttercms'
  export default {
    name: 'blog-home',
    data() {
      return {
        page_title: 'Blog',
        posts: []
      }
    },
    methods: {
      getPosts() {
        butter.post.list({
          page: 1,
          page_size: 10
        }).then((res) => {
          // console.log(res.data)
          this.posts = res.data.data
        })
      }
    },
    created() {
      this.getPosts()
    }
  }
</script>

Display the result

<template>
  <div id="blog-home">
      <h1>{{ page_title }}</h1>
      <!-- Create v-for and apply a key for Vue. Example is using a combination of the slug and index -->
      <div v-for="(post,index) in posts" :key="post.slug + '_' + index">
        <router-link :to="'/blog/' + post.slug">
          <article class="media">
            <figure>
              <!-- Bind results using a ':' -->
              <!-- Use a v-if/else if their is a featured_image -->
              <img v-if="post.featured_image" :src="post.featured_image" alt="">
              <img v-else src="http://via.placeholder.com/250x250" alt="">
            </figure>
            <h2>{{ post.title }}</h2>
            <p>{{ post.summary }}</p>
          </article>
        </router-link>
      </div>
  </div>
</template>

Now create components/BlogPost.vue which will be your Blog Post page to list a single post.

<script>
  import { butter } from '@/buttercms'
  export default {
    name: 'blog-post',
    data() {
      return {
        post: {}
      }
    },
    methods: {
      getPost() {
        butter.post.retrieve(this.$route.params.slug)
          .then((res) => {
            // console.log(res.data)
            this.post = res.data
          }).catch((res) => {
            console.log(res)
          })
      }
    },
    created() {
      this.getPost()
    }
  }
</script>

Display the results

<template>
  <div id="blog-post">
    <h1>{{ post.data.title }}</h1>
    <h4>{{ post.data.author.first_name }} {{ post.data.author.last_name }}</h4>
    <div v-html="post.data.body"></div>

    <router-link v-if="post.meta.previous_post" :to="/blog/ + post.meta.previous_post.slug" class="button">
      {{ post.meta.previous_post.title }}
    </router-link>
    <router-link v-if="post.meta.next_post" :to="/blog/ + post.meta.next_post.slug" class="button">
      {{ post.meta.next_post.title }}
    </router-link>
  </div>
</template>

Now our app is pulling all blog posts and we can navigate to individual posts.However, our next/previous post buttons are not working.

One thing to note when using routes with params is that when the user navigates from /blog/foo to /blog/bar, the same component instance will be reused. Since both routes render the same component, this is more efficient than destroying the old instance and then creating a new one. However, this also means that the lifecycle hooks of the component will not be called.

Visit the Vue.js docs to learn more about Dynamic Route Matching

To fix this we need to simply watch the $route object and call getPost() when the route changes.

Updated script section in components/BlogPost.vue:

<script>
  import { butter } from '@/buttercms'
  export default {
    name: 'blog-post',
    data() {
      return {
        post: {}
      }
    },
    methods: {
      getPost() {
        butter.post.retrieve(this.$route.params.slug)
          .then((res) => {
            // console.log(res.data)
            this.post = res.data
          }).catch((res) => {
            console.log(res)
          })
      }
    },
    watch: {
      $route(to, from) {
        this.getPost()
      }
    },
    created() {
      this.getPost()
    }
  }
</script>

Now our app has a working blog that can be updated easily in the ButterCMS dashboard.

Try ButterCMS in your Vue.js app

About ButterCMS

ButterCMS is an API-based, or "headless", CMS. We're a hosted service and we maintain all of the infrastructure. For more information on how we compare to a traditional CMS check out API-based CMS vs Traditional CMS.

How do you compare to Wordpress?

In short, we offer all the same easy-to-use editing capabilities of Wordpress but are significantly easier for developers to setup and maintain. This means you spend less time working on your CMS and more time focusing on things important to your business.

Learn more about how we're a wordpress alternative.

What's my blog going to look like?

Unlike CMS's you might be used to, we don't control or host any of your templates. The design of your blog (HTML + CSS) lives in your application along side the rest of your app. Your application calls our Blog Engine API to get the raw blog post content and then injects it into your own templates during rendering. This has many benefits including blog your instantly matching the rest of your site branding giving it a unique feel; not the cookie-cutter blog themes you'll experience with other CMS's.

Can I import my existing blog content?

Yep. To import content from another platform, simply send us an email.

What kind of database can I use?


No database required! We're a SaaS CMS or CaaS. You simply call our Content API from your app. We host and maintain all of the CMS infrastructure.

Can I host this?


No, we're a SaaS CMS or CaaS. You simply call our Content API from your app. We host and maintain all of the CMS infrastructure.

I have other questions


We're happy to help.

Chat with us

About Vue.js

Vue is a progressive framework for building user interfaces. Unlike other monolithic frameworks, Vue is designed from the ground up to be incrementally adoptable.

Blog Engine for these technologies and more

Ruby, Rails, Node.js, Python, ASP.NET, C#, Flask, Django, Go, PHP, React, Phoenix, Elixir, Angular, Vue.js

Try Butter free for 30-days

Try ButterCMS in your Vue.js app

Get started now

Sign up with Google Sign up with Github
or