Public pages management with Asset Pipeline.
Inspired by gakubuchi.
In app/views/public_pages/404.html.haml:
- provide(:title, 'Not found')
%h1 Not found
%p This webpage is not found.
%p= link_to 'Home', root_path
In app/views/public_pages/500.html.haml:
- provide(:title, 'Server error')
%h1 Server error
%p This webpage is not working.
In app/views/public_pages/robots.text.erb:
<% unless Rails.env.production? %>
User-Agent: *
Disallow: /
<% end %>
In app/views/layout/public.html.haml:
!!!
%html
%head
%title #{yield(:title)} | MyAPP
= stylesheet_link_tag 'application', media: 'all'
= favicon_link_tag '/favicon.ico'
%body
= yield
Compile the templeate with:
rake assets:precompile
or
rake hanmoto:publish
This will generate public/404.html
, public/500.html
, and public/robots.txt
.
Add this line to your application's Gemfile:
gem 'hanmoto'
And then execute:
$ bundle
Or install it yourself as:
$ gem install hanmoto
In config/initializers/hanmoto.rb
, you can configure the following values.
Hanmoto.configure do |config|
# config.view_dir = 'public_page'
# config.layouts = {
# html: 'public',
# }
end
Contribution directions go here.
The gem is available as open source under the terms of the MIT License.