Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/buttercms/buttercms-rails
Ruby gem to quickly integrate ButterCMS into a current Rails project
https://github.com/buttercms/buttercms-rails
cms rails ruby
Last synced: 2 months ago
JSON representation
Ruby gem to quickly integrate ButterCMS into a current Rails project
- Host: GitHub
- URL: https://github.com/buttercms/buttercms-rails
- Owner: ButterCMS
- License: other
- Created: 2016-02-15T18:54:13.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-11T16:43:30.000Z (9 months ago)
- Last Synced: 2024-04-11T19:24:11.620Z (9 months ago)
- Topics: cms, rails, ruby
- Language: HTML
- Homepage: https://buttercms.com
- Size: 23.4 KB
- Stars: 41
- Watchers: 6
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ButterCMS Rails Blog Generator
This repo provides a generator that expedites setup of your ButterCMS blog into a currently existing Rails project.
This repo is no longer being currently maintained; however, if you'd like to try out ButterCMS and Rails
with our new [Rails Starter Project](https://buttercms.com/starters/rails-starter-project/), you can
be up and running with a Rails + ButterCMS project within two minutes--including a hosted deployment
to Heroku!## Documentation
For a comprehensive list of examples and API docs, check out our [documentation](https://buttercms.com/docs/).
### Installation
To get started, first install the gem by adding it to your Gemfile:
```
gem 'buttercms-rails'
```After installing, run the genereator provided by the gem:
```
rails generate butter:install_blog
```The generator creates an initializer file and default controllers and views:
```
|-- app
|-- controllers
|-- buttercms
|-- authors_controller.rb
|-- base_controller.rb
|-- categories_controller.rb
|-- feeds_controller.rb
|-- posts_controller.rb
|-- views
|-- buttercms
|-- authors
|-- show.html.erb
|-- categories
|-- show.html.erb
|-- posts
|-- _post.html.erb
|-- index.html.erb
|-- show.html.erb
|-- layouts
|-- buttercms
|-- default.html.erb|-- config
|-- initializers
|-- buttercms.rb
```It also adds routes to your `routes.rb` file:
```ruby
scope :module => 'buttercms' do
get '/categories/:slug' => 'categories#show', :as => :buttercms_category
get '/author/:slug' => 'authors#show', :as => :buttercms_authorget '/blog/rss' => 'feeds#rss', :format => 'rss', :as => :buttercms_blog_rss
get '/blog/atom' => 'feeds#atom', :format => 'atom', :as => :buttercms_blog_atom
get '/blog/sitemap.xml' => 'feeds#sitemap', :format => 'xml', :as => :buttercms_blog_sitemapget '/blog(/page/:page)' => 'posts#index', :defaults => {:page => 1}, :as => :buttercms_blog
get '/blog/:slug' => 'posts#show', :as => :buttercms_post
end
```After running the generator, set your API token in `config/initializers/buttercms.rb` and then start your server to view your blog.
### Customization
Extending and customizing your blog is easy. The ButterCMS Rails SDK uses the [ButterCMS Ruby API Client](https://github.com/buttercms/buttercms-ruby). Email [[email protected]](mailto:[email protected]) for help!
### Fallback Data Store
The ButterCMS Ruby client supports automatic fallback to a data store when API requests fail. Learn more in the [buttercms-ruby README](https://github.com/buttercms/buttercms-ruby/tree/master#fallback-data-store).
### Test mode
Test mode can be used to setup a staging website for previewing content or for testing content during local development. To fetch content from test mode add the following to your initializer:
```ruby
ButterCMS::test_mode = true
```### Other
View Rails [Blog engine](https://buttercms.com/rails-blog-engine/) and [Full CMS](https://buttercms.com/rails-cms/) for other examples of using ButterCMS with Rails.