Skip to main content

Overview

This integration guide shows you how to how to update your existing project to:
  1. install the ButterCMS package
  2. instantiate ButterCMS
  3. create components to fetch and display each of the three ButterCMS content types: Pages, Collections, and Blog Posts.
In order for the snippets to work, you’ll need to setup your dashboard content schemas inside of ButterCMS first.

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.

Go Starter Project

Hit the ground running with a pre-configured Go + ButterCMS setup.

Installation

Set your API token as an environment variable:

Initialize the Client

For complete SDK documentation including all available methods and configuration options, see the Go SDK Reference.

Pages

Create a Page Type:
  1. Go to Content TypesPage Types → Click +
  2. Add fields to your schema:
    • Short Text field named headline
    • Long Text field named subheadline
    • Media field named hero_image
    • WYSIWYG field named body
  3. Click Create Page Type and name it Landing Page (slug: landing_page)
Create a Page:
  1. Go to PagesNew Page → Select Landing Page
  2. Enter a title (e.g., “Home”) which generates slug home
  3. Fill in your content and click Publish

Collections

Create a Collection:
  1. Go to Content TypesCollections → Click +
  2. Add fields to your schema:
    • Short Text field named name
    • Media field named logo
    • WYSIWYG field named description
  3. Click Create Collection and name it Brands (key: brands)
Add Collection Items:
  1. After saving, the create item screen loads automatically
  2. Fill in your brand details and click Save
  3. Add more items via Collections → hover Brands → click +

Dynamic Components

Create Components:
  1. Go to Content TypesComponents → Click +
  2. Create a Hero component with fields:
    • headline (Short Text)
    • subheadline (Long Text)
    • image (Media)
    • button_label (Short Text)
    • button_url (Short Text)
  3. Create additional components (Features, Testimonials, CTA, etc.)
Add Component Picker to Page Type:
  1. Edit your Page Type schema
  2. Add a Component field named body
  3. Select which components can be used in this field
  4. Content editors can now drag-and-drop components when creating pages

Component Renderer

Component Template

Using in Handlers

Blog

ButterCMS includes a pre-built blog engine with posts, authors, categories, and tags.Create a Blog Post:
  1. Go to Blog PostsNew Post
  2. Enter a title, body content using the rich text editor
  3. Optionally add a featured image, categories, tags, and author
  4. Click Publish
The blog engine automatically provides:
  • Post slugs, summaries, and SEO fields
  • Author profiles with bio and social links
  • Categories and tags for organization
  • RSS and Atom feeds

Caching

Use an in-memory cache for better performance:

SEO

Resources

Go Starter

Pre-configured starter project

Go SDK

Complete SDK reference

GitHub Repository

View source code

Content API

REST API documentation