Butter CMS for Rails
**Why Butter?**
Butter makes setting up a professional company blog on Rails insanely easy. It’s built for developers to save us from hosting, DB setup, themeing, maintaining yet another Wordpress install. It’s designed to be quickly integrated to an existing Rails project.
Butter provides a user friendly blogging UI, hosted on buttercms.com, and exposes content created via an API.
This package provides a Rails Engine that interacts with the Butter API to get you up and running in seconds.
Sitemap + Feeds
Your new blog comes built-in with a sitemap.xml, RSS + Atom feeds for maximum SEO benefit. You can use these to syndicate your content to social networks, improve search engine indexation, and more.
Sitemap: localhost:3000/blog/sitemap.xml (named route :blog_sitemap)
RSS: localhost:3000/blog/rss/ (named route :blog_rss)
Atom: localhost:3000/blog/atom/ (named route :blog_atom)
Installation
Add buttercms gem to your Gemfile and install it.
- .. code-block
-
ruby
# In Gemfile
gem 'buttercms'
- .. code-block
-
bash
$ gem install buttercms
Now run the Butter install generator. This will setup a ‘butter.rb` initializer, which provides many customization options, and defines a route in `config/routes.rb`. By default, your blog will live at “/blog”.
- .. code-block
-
bash
$ rails g buttercms:install
Grab your API token from buttercms.com/api_token and throw it in ‘config/initializers/butter.rb` or set it on your ENV like so `$ export BUTTER_TOKEN=yourtokenhere“`
That’s it! You’ve now got a blog running natively in your Rails project.
Check it out: localhost:3000/blog
Log into buttercms.com/ to start blogging!
Customizing your blog
We’ve provided you with a pre-scaffolded blog. Simply crack open any of the files in the newly created /blog/ directory you created in the step above and modify those templates as you would any other. Customizing your blog is now the same flow as the rest of your site! No longer do you have to hack Wordpress PHP scripts.
Specify the Blog Layout
We’ve provided a default layout but we expect you’ll want the blog to appear your branded layout so we’ve made this as simple as defining ‘config.layout` in `initializers/butter.rb`
- .. code
-
ruby
# In initializers/butter.rb
config.layout = "<your_blog_layout>"
Note that an ideal layout simply defines the header and footer for the page and ‘<%= yields %>` the main body. Restart the server and go to localhost:3000/blog and you’ll see your new branded blog!