Overview
This integration guide shows you how to how to update your existing project to:- install the ButterCMS package
- instantiate ButterCMS
- create components to fetch and display each of the three ButterCMS content types: Pages, Collections, and Blog Posts.
Starter project
Or, you can jump directly to the starter project below, which will allow you to clone, install, run, and deploy a fully working starter project that’s integrated with content already inside of your ButterCMS account.Gridsome Starter Project
Hit the ground running with a pre-configured Gridsome + ButterCMS setup.
Installation
- npm
- yarn
- pnpm
.env:
Initialize the client
Create a reusable client module:For complete SDK documentation including all available methods and configuration options, see the JavaScript SDK Reference.
Pages
Gridsome loads external data at build time viagridsome.server.js. Add a custom data source to fetch ButterCMS pages:
Collections
Add your collections to the Gridsome data store:Dynamic components
Component Renderer
Example Component
Using in templates
Blog
Add blog posts to the data store ingridsome.server.js:
- Blog Post List
- Single Blog Post
Resources
Gridsome Starter
Pre-configured starter project
JavaScript SDK
Complete SDK reference
GitHub Repository
View source code
Content API
REST API documentation