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.Astro Starter Project
Hit the ground running with a pre-configured Astro + ButterCMS setup.
Installation
- npm
- yarn
- pnpm
.env:
Initialize the client
Create a reusable client instance:For complete SDK documentation including all available methods and configuration options, see the JavaScript SDK Reference.
Pages
- Static (SSG)
- Server (SSR)
Collections
Dynamic components
Component Renderer
Example Component
Using in Pages
Blog
- Blog Post List
- Single Blog Post
Preview Mode
Enable draft content preview with SSR:SEO
Resources
Astro Starter
Pre-configured starter project
JavaScript SDK
Complete SDK reference
GitHub Repository
View source code
Content API
REST API documentation