sitemap snippets

How to submit your sitemap to multiple search engines

Tagged google, seo, sitemap, search  Languages 

To submit your sitemap to search engines—at least Google, MSN and Yahoo support this feature—add this line to your robots.txt file:

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

This allows the search engine to find your sitemap when it visits your site, which means you don't have to manually register it with each search engine.

How to automatically ping search engines when your sitemap has changed

Tagged ruby, ping, search, google, sitemap  Languages ruby

I prefer letting cron update sitemaps in the background, and at the end of the script I ping search engines to let them know it's been updated:

# Recreate sitemap goes here

# Let search engines know about the update
[ "http://www.google.com/webmasters/tools/ping?sitemap=http://xxx/sitemap.xml",
  "http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=http://xxx/sitemap.xml",
  "http://submissions.ask.com/ping?sitemap=http://xxx/sitemap.xml",
  "http://webmaster.live.com/ping.aspx?siteMap=http://xxx/sitemap.xml" ].each do |url|
  open(url) do |f|
    if f.status[0] == "200"
      puts "Sitemap successfully submitted to #{url}"      
    else
      puts "Failed to submit sitemap to #{url}"
    end
  end
end

More about sitemaps: http://en.wikipedia.org/wiki/Sitemaps