
Spring Blog Engine
You've got better things to do than build another blog
Add Butter to your Spring app and get back to more interesting problems
"Best CMS on the market"

ButterCMS is an API-based Spring blog engine that integrates with Spring in minutes. With ButterCMS it's possible to launch the perfect company blog in Spring.
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 IdeaAll your requirements, solved
Use main domain (for SEO)
Friendly admin interface
Upload images and media
Edit slugs and meta tags
Tag and categorize posts
RSS/Atom Feeds
Search
Webhooks
Powerful admin interface

Integrates with Spring
Our blog engine has a simple API and drop-in Spring 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 Spring appSetup in minutes
Integrating Butter into your Spring 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 an integration guide check out our Official Spring Guide
To display posts we create a simple /blog
route in our app and fetch blog posts from the Butter API. 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.
com.yourorganization.app.controllers
@Controller
public class BlogController {
private IButterCMSClient butterCMSClient;
public BlogController(IButterCMSClient butterCMSClient) {
this.butterCMSClient = butterCMSClient;
}
@RequestMapping("/blogs")
public String getBlogs(Model model, @RequestParam(value = "category", required = false) String category, @RequestParam(value = "tag", required = false) String tag) {
PostsResponse posts = butterCMSClient.getPosts(new HashMap<String, String>() {{
put("category_slug", category);
put("tag_slug", tag);
}});
if (posts.getData() == null || posts.getData().isEmpty()) {
return "404";
}
model.addAttribute("blogs", posts.getData().stream()
.map(value ->
new HashMap<String, String>() {{
put("slug", value.getSlug());
put("title", value.getTitle());
}}
).collect(Collectors.toList()));
model.addAttribute("category", category);
model.addAttribute("tag", tag);
return "blog/blogs";
}
Next we'll create a simple view at src/main/webapp/WEB-INF/jsp/blog/blogs.jsp
that displays our posts and pagination links:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello! This is Java ButterCMS example!</title>
</head>
<body>
<h2 class="hello-title">Hello! This is Java ButterCMS example!</h2>
<h3>Here is a list of Posts</h3>
<c:if test="${not empty tag}">
<h4>Tag: ${tag}</h4>
</c:if>
<c:if test="${not empty category}">
<h4>Category: ${category}</h4>
</c:if>
<ul>
<c:forEach items="${blogs}" var="blog">
<li><a href="/blog/${blog["slug"]}">${blog["title"]}</a></li>
</c:forEach>
</ul>
</body>
</html>
We'll also create an additional route and controller method for displaying individual posts:
@RequestMapping("/blog/{slug}")
public String getBlog(Model model, @PathVariable("slug") String slug) {
PostResponse post = butterCMSClient.getPost(slug);
model.addAttribute("blog", post.getData());
return "blog/blog";
}
The view for displaying a full post includes information such as author, publish date, and categories. See a full list of available post properties in our API reference. We use the Page object for setting the HTML title and meta description in the tag of the page.
src/main/webapp/WEB-INF/jsp/blog/blogs.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<title>${blog.seoTitle}</title>
<meta property="og:title" content="${blog.seoTitle}"/>
<meta property="og:image" content="${blog.featuredImage}"/>
<meta property="og:description" content="${blog.metaDescription}"/>
</head>
<body>
<h1>${blog.title}</h1>
<ul>
<li>Author: ${blog.author.firstName} ${blog.author.lastName}</li>
<li>Published: ${blog.published}</li>
<li>Tags:
<c:forEach items="${post.tags}" var="tag">
${tag.name}
</c:forEach>
</li>
</ul>
<img src="${blog.featuredImage}"/>
<div>
<c:out value="${blog.body}" escapeXml="false"/>
</div>
</body>
</html>
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 usAbout Spring
Spring is a general-purpose programming language that is class-based, object-oriented, and designed to have as few implementation dependencies as possible.