Skip to content

Commit

Permalink
- put message about Yahoo AppIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsalter committed Sep 14, 2009
1 parent 9c704c3 commit e5e261d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
19 changes: 15 additions & 4 deletions lib/sitemap_generator/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,30 @@ def w3c_date(date)
end

def ping_search_engines(sitemap_index)
require 'open-uri'
index_location = CGI.escape(url_with_hostname(sitemap_index))
# engines list from http://en.wikipedia.org/wiki/Sitemap_index
yahoo_app_id = SitemapGenerator::Sitemap.yahoo_app_id
{:google => "http://www.google.com/webmasters/sitemaps/ping?sitemap=#{index_location}",
:yahoo => "http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=#{index_location}",
:yahoo => "http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=#{index_location}&appid=#{yahoo_app_id}",
:ask => "http://submissions.ask.com/ping?sitemap=#{index_location}",
:bing => "http://www.bing.com/webmaster/ping.aspx?siteMap=#{index_location}",
:sitemap_writer => "http://www.sitemapwriter.com/notify.php?crawler=all&url=#{index_location}"}.each do |engine, link|
begin
require 'open-uri'
open(link)
puts "Successful ping of #{engine.to_s.titleize}"
unless SitemapGenerator::Sitemap.yahoo_app_id == false
open(link)
puts "Successful ping of #{engine.to_s.titleize}" unless ENV['SILENT'].present?
end
rescue StandardError => e
puts "Ping failed for #{engine.to_s.titleize}: #{e.inspect}"
puts <<-END if engine == :yahoo
Yahoo requires an 'AppID' for more than one ping per "timeframe", you can either:
- remove yahoo from the ping list (config/sitemap.rb):
SitemapGenerator::Sitemap.yahoo_app_id = false
- or add your Yahoo AppID to the generator (config/sitemap.rb):
SitemapGenerator::Sitemap.yahoo_app_id = "my_app_id"
For more information: http://developer.yahoo.com/search/siteexplorer/V1/updateNotification.html
END
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/sitemap_generator/link_set.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module SitemapGenerator
class LinkSet
attr_accessor :default_host, :links
attr_accessor :default_host, :yahoo_app_id, :links

def initialize
@links = []
Expand Down
1 change: 1 addition & 0 deletions test/mock_app/config/sitemap.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SitemapGenerator::Sitemap.default_host = "http://www.example.com"
SitemapGenerator::Sitemap.yahoo_app_id = false

SitemapGenerator::Sitemap.add_links do |sitemap|
sitemap.add contents_path, :priority => 0.7, :changefreq => 'daily'
Expand Down

0 comments on commit e5e261d

Please sign in to comment.