Life In The Stack Trace...

Duck Map Quick Start

Duck Map Quick Start

Including a sitemap into your Rails app is very easy with Duck Map. The following steps are taken directly from the
README.md included in the duck_map.gem

# open a shell and navigate to a work directory.
# create a Rails app
rails new test.com --skip-bundle
# add the following to your Rails app test.com/Gemfile
gem 'duck_map'
# depending on your Rails version, you may have to add the following lines as well.
gem 'execjs'
gem 'therubyracer'
# make sure you have all the gems, etc.
bundle install
# create a controller
rails g controller home
# create a route in config/routes.rb
root :to => 'home#index'
# start the server
rails s
# view the sitemap
http://localhost:3000/sitemap.xml
# if you view the HTML source of: http://localhost:3000/sitemap.xml
# you should see something similar to the following:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://localhost:3000/</loc>
<lastmod>2011-10-27T13:02:15+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
</urlset>

You can download the support file and run the actual app used in the video. Be sure to run: bundle install !!