<commit_before>Dynamic Sitemaps is a plugin for Ruby on Rails that enables you to easily create flexible, dynamic sitemaps.
It creates sitemaps in the http://sitemaps.org standard which is supported by several crawlers including Google, Bing, and Yahoo.
If the sitemap has more than 50.000 urls – or whatever you set it to using <code>per_page</code> – the plugin will automatically split the sitemap into smaller chunks and generate a sitemap index, also specified at http://sitemaps.org.


== Installation

In your <em>Gemfile</em>:

  gem 'dynamic_sitemaps'
  
Then run <code>bundle install</code>.

== Example

Start by generating initializer and route:

  $ rails generate dynamic_sitemaps sitemap
  

In <code>config/initializers/sitemap.rb</code>:

  DynamicSitemaps::Sitemap.draw do

    # default page size is 50.000 which is the specified maximum at http://sitemaps.org.
    per_page 10

    url root_url, :last_mod => DateTime.now, :change_freq => 'daily', :priority => 1
  
    new_page!
  
    Product.all.each do |product|
      url product_url(product), :last_mod => product.updated_at, :change_freq => 'monthly', :priority => 0.8
    end

    new_page!
  
    autogenerate  :products, :categories,
                  :last_mod => :updated_at,
                  :change_freq => 'monthly',
                  :priority => 0.8
                
    new_page!
  
    autogenerate  :users,
                  :last_mod => :updated_at,
                  :change_freq => lambda { |user| user.very_active? ? 'weekly' : 'monthly' },
                  :priority => 0.5

  end


Then go to http://yourdomain.com/sitemap.xml in your browser.


== Installing the sitemap

In <code>public/robots.txt</code>:

  Sitemap: http://yourdomain.com/sitemap.xml

This will enable crawlers to find your sitemap.


== Submitting the sitemap to crawlers

=== Google

1. Go to Google Webmaster Central at http://www.google.com/webmasters/ and sign in

2. Click "Add a site..." and follow instructions for adding your site and verify ownership

3. Go to Site configuration > Sitemaps and click "Submit a Sitemap"

4. Type in sitemap.xml – no domain is needed as this is locked to your current website

5. Click "Submit Sitemap"

Google will now download and use your sitemap.

=== Bing

Go to Webmaster Tools at http://www.bing.com/toolbox/webmasters/ and follow instructions.
  
=== Yahoo

Go to Site Explorer at http://siteexplorer.search.yahoo.com/ and follow instructions.


== Notifying search engines with changes to the sitemap

If you want to notify search engines with changes to your sitemap, see the Sitemap Notifier (https://github.com/lassebunk/sitemap_notifier) plugin.


== Todo's

* Do it so that in your development environment you can see the sitemap without having to restart the server


== Contributors

* <NAME> (creator)
* <NAME>


Copyright (c) 2010-2011 <NAME>, released under the MIT license<commit_msg>add contributor<commit_after>Dynamic Sitemaps is a plugin for Ruby on Rails that enables you to easily create flexible, dynamic sitemaps.
It creates sitemaps in the http://sitemaps.org standard which is supported by several crawlers including Google, Bing, and Yahoo.
If the sitemap has more than 50.000 urls – or whatever you set it to using <code>per_page</code> – the plugin will automatically split the sitemap into smaller chunks and generate a sitemap index, also specified at http://sitemaps.org.


== Installation

In your <em>Gemfile</em>:

  gem 'dynamic_sitemaps'
  
Then run <code>bundle install</code>.

== Example

Start by generating initializer and route:

  $ rails generate dynamic_sitemaps sitemap
  

In <code>config/initializers/sitemap.rb</code>:

  DynamicSitemaps::Sitemap.draw do

    # default page size is 50.000 which is the specified maximum at http://sitemaps.org.
    per_page 10

    url root_url, :last_mod => DateTime.now, :change_freq => 'daily', :priority => 1
  
    new_page!
  
    Product.all.each do |product|
      url product_url(product), :last_mod => product.updated_at, :change_freq => 'monthly', :priority => 0.8
    end

    new_page!
  
    autogenerate  :products, :categories,
                  :last_mod => :updated_at,
                  :change_freq => 'monthly',
                  :priority => 0.8
                
    new_page!
  
    autogenerate  :users,
                  :last_mod => :updated_at,
                  :change_freq => lambda { |user| user.very_active? ? 'weekly' : 'monthly' },
                  :priority => 0.5

  end


Then go to http://yourdomain.com/sitemap.xml in your browser.


== Installing the sitemap

In <code>public/robots.txt</code>:

  Sitemap: http://yourdomain.com/sitemap.xml

This will enable crawlers to find your sitemap.


== Submitting the sitemap to crawlers

=== Google

1. Go to Google Webmaster Central at http://www.google.com/webmasters/ and sign in

2. Click "Add a site..." and follow instructions for adding your site and verify ownership

3. Go to Site configuration > Sitemaps and click "Submit a Sitemap"

4. Type in sitemap.xml – no domain is needed as this is locked to your current website

5. Click "Submit Sitemap"

Google will now download and use your sitemap.

=== Bing

Go to Webmaster Tools at http://www.bing.com/toolbox/webmasters/ and follow instructions.
  
=== Yahoo

Go to Site Explorer at http://siteexplorer.search.yahoo.com/ and follow instructions.


== Notifying search engines with changes to the sitemap

If you want to notify search engines with changes to your sitemap, see the Sitemap Notifier (https://github.com/lassebunk/sitemap_notifier) plugin.


== Todo's

* Do it so that in your development environment you can see the sitemap without having to restart the server


== Contributors

* <NAME> (creator)
* <NAME>
* <NAME>


Copyright (c) 2010-2011 <NAME>, released under the MIT license
{'fraction_non_alphanumeric': 0.08991265627675972, 'fraction_numerical': 0.010960780955643089, 'mean_word_length': 3.2014388489208634, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 56, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5026863', 'n_tokens_mistral': 1841, 'n_tokens_neox': 1728, 'n_words': 661}