Sitemap Generator

Episode #7 by David Kimura

Summary

Adding Search Engine Optimization to your site is easy. However, maintaining it can be difficult. This episode shows how to approach the sitemap indexing.
rails seo 5:06

Resources

Summary

# Gemfile
  gem 'sitemap_generator'

# bash
  rake sitemap:install

# config/sitemap.rb
  SitemapGenerator::Sitemap.default_host = "https://www.example.com"
  SitemapGenerator::Sitemap.create do
    add blogs_path, :priority => 0.5, :changefreq => 'daily'
    Blog.find_each do |blog|
      add blog_path(blog), :lastmod => blog.updated_at, :priority => 0.5
    end
  end

# bash
  #Generates the Sitemap
  rake sitemap:create

  #Generates and submits the Sitemap
  rake sitemap:refresh