If you have to put static pages in your Rails application, it’s super simple in since Rails 3.
On top of your routes.rb
match ':action' => 'static#:action'
Now let’s create a empty Controller named Static
rails g controller Static
Now put your Static pages under yourapp/app/views/static/ Let’s supose you want to have a home.html
Create the file yourapp/app/views/static/home.html with the content above:
<h1>My page</h1> <p>This is my pure HTML page</p>
Now you can access http://localhost:3000/home.html or simple http://localhost:3000/home or even http://localhost:3000/home.whatever
It’s should work even with rails templates like Erb, creating the file yourapp_/app/views/static/homerendered.html.erb with the content above:
<h1><%= 'My page with ERB rendereing'%></h1> <p><%= 'Now this page has rendered with ERB' %></p>
- Clone Enki Blog if you don’t have a runnig blog
git clone git://github.com/xaviershay/enki.git
- A good ideia is to create a new branch to bring the sitemap feature into your application before production
git branch sitemap git checkout sitemap
- Now you have to add the remote with the Enki blog sitemap implementation
git remote feromes add feromes email@example.com:fernandogomes/enki.git git fetch feromes
- The last step to bring the code is bring the code into our app. You can do that simple merging the code
git merge feromes/sitemap
- Before put your sitemaps in production on Branch Master would be good if you test you application with your production Posts and Pages, after you’ve done that, it’s time to put it on production.
git checkout master git merge sitemap
If everithing has done you’re be able to access yoursite.com/sitemap.