0

sitemap_generator gemを使用して、サブドメインを備えたアプリのサイトマップを作成しようとしています。 ただし、コードでエラーが発生します。

the scheme http does not accept registry part: .foo.com (or bad hostname?)

私のsitemap.rb:

SitemapGenerator::Sitemap.default_host = "http://www.foo.com"
SitemapGenerator::Sitemap.sitemaps_host = "http://s3.amazonaws.com/foo/"
SitemapGenerator::Sitemap.public_path = 'tmp/'
SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/'
SitemapGenerator::Sitemap.adapter = SitemapGenerator::WaveAdapter.new

SitemapGenerator::Sitemap.create do
  add '/home' 
end

Customer.find_each do |customer|
  SitemapGenerator::Sitemap.default_host = "http://#{customer.user_name}.foo.com"
  SitemapGenerator::Sitemap.sitemaps_path = "sitemaps/#{customer.user_name}"
  SitemapGenerator::Sitemap.create do
    add '/home'
  end  
end

私は何を間違っていますか?

4

1 に答える 1

2

私はこの宝石の作者です。

URL で許可されていない文字を含む顧客のユーザー名の 1 つに問題があることは確かです。単純な名前を使用した単純なテストは、次のように機能します。

%w(bill mary bob).each do |customer|
  SitemapGenerator::Sitemap.default_host = "http://#{customer}.foo.com"
  SitemapGenerator::Sitemap.sitemaps_path = "sitemaps/#{customer}"
  SitemapGenerator::Sitemap.create do
    add '/home'
  end  
end
于 2013-05-02T22:49:42.460 に答える