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.Go Starter Project
Hit the ground running with a pre-configured Go + ButterCMS setup.
Installation
Initialize the Client
- Standard Library
- Gin Framework
For complete SDK documentation including all available methods and configuration options, see the Go SDK Reference.
Pages
ButterCMS Dashboard Setup
ButterCMS Dashboard Setup
Create a Page Type:
- Go to Content Types → Page Types → Click +
- Add fields to your schema:
- Short Text field named
headline - Long Text field named
subheadline - Media field named
hero_image - WYSIWYG field named
body
- Short Text field named
- Click Create Page Type and name it
Landing Page(slug:landing_page)
- Go to Pages → New Page → Select Landing Page
- Enter a title (e.g., “Home”) which generates slug
home - Fill in your content and click Publish
- Standard Library
- Gin Framework
Collections
ButterCMS Dashboard Setup
ButterCMS Dashboard Setup
Create a Collection:
- Go to Content Types → Collections → Click +
- Add fields to your schema:
- Short Text field named
name - Media field named
logo - WYSIWYG field named
description
- Short Text field named
- Click Create Collection and name it
Brands(key:brands)
- After saving, the create item screen loads automatically
- Fill in your brand details and click Save
- Add more items via Collections → hover Brands → click +
- Standard Library
- Gin Framework
Dynamic Components
ButterCMS Dashboard Setup
ButterCMS Dashboard Setup
Create Components:
- Go to Content Types → Components → Click +
- Create a Hero component with fields:
headline(Short Text)subheadline(Long Text)image(Media)button_label(Short Text)button_url(Short Text)
- Create additional components (Features, Testimonials, CTA, etc.)
- Edit your Page Type schema
- Add a Component field named
body - Select which components can be used in this field
- Content editors can now drag-and-drop components when creating pages
Component Renderer
Component Template
Using in Handlers
Blog
ButterCMS Dashboard Setup
ButterCMS Dashboard Setup
ButterCMS includes a pre-built blog engine with posts, authors, categories, and tags.Create a Blog Post:
- Go to Blog Posts → New Post
- Enter a title, body content using the rich text editor
- Optionally add a featured image, categories, tags, and author
- Click Publish
- Post slugs, summaries, and SEO fields
- Author profiles with bio and social links
- Categories and tags for organization
- RSS and Atom feeds
- Blog Post List
- Single Blog Post
- Standard Library
- Gin Framework
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