2016-03-28 17 views
0

bulunmayan config/sitemap.rb aşağıdaki yapılandırmaya sahip: Ben Site Haritası dosyası Ben sitemap_generator gem kullanarak ve am üretim

uygulama localhost'a alanımı değişti

require 'rubygems' 
require 'sitemap_generator' 

SitemapGenerator::Sitemap.default_host = 'http://www.localhost.com' 

SitemapGenerator::Sitemap.create do 
    add '/', :changefreq => 'daily', :priority => 0.9 
    add '/contact', :changefreq => 'weekly' 

    User.find_each do |user| 
    add users_path(user), lastmod: user.updated_at 
    end 
end 

SitemapGenerator::Sitemap.ping_search_engines 
  • kahramana ev sahipliği yapmaktadır. Ben heroku run rake sitemap:refresh yaptığınızda aşağıdaki sonuçlar

    In '/app/public/': 
    + sitemap.xml.gz           76 links/ 1.53 KB 
    Sitemap stats: 76 links/1 sitemaps/0m00s 
    
    Pinging with URL 'http://www.localhost.com/sitemap.xml.gz': 
        Successful ping of Google 
        Successful ping of Bing 
    
    Pinging with URL 'http://www.localhost.com/sitemap.xml.gz': 
        Successful ping of Google 
        Successful ping of Bing 
    

    Şimdi sitemap.xml.gz dosyası ve hiçbir yerde Heroku üzerine bulmaya olsun. Ben heroku run rake ls, heroku run rake ls tmp ve heroku run rake ls public yapıyorum ve hiçbir yerde bulunamadı.

    SitemapGenerator::Sitemap.public_path = 'tmp/' 
    SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/' 
    

    ama yine site haritaları bu klasörler oluşturulur değildi: Geçmişte

    Ben de sitemap.rb üzerindeki bu iki satırı vardı. Yanlış yaptığım ve üretmediğim hakkında bir ipucu var mı?

cevap

0

Çözüm here'u buldum.

SitemapGenerator::Sitemap.adapter = SitemapGenerator::S3Adapter.new(fog_provider: 'AWS', 
            aws_access_key_id: <your-access-key-id>, 
            aws_secret_access_key: <your-access-key>, 
            fog_directory: <your-bucket>, 
            fog_region: <your-aws-region e.g. us-west-2>) 
0

Heroku'nun kalıcı dosya sistemi yok. Bu nedenle, heroku'daki tüm yüklemeler kalıcı değildir. Daha fazla bilgi için bu belgeye göz atın. https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem

+0

yapayım bu ne anlama geliyor:

# Set the host name for URL creation SitemapGenerator::Sitemap.default_host = "http://example.com" # pick a place safe to write the files SitemapGenerator::Sitemap.public_path = 'tmp/' # store on S3 using Fog (pass in configuration values as shown above if needed) SitemapGenerator::Sitemap.adapter = SitemapGenerator::S3Adapter.new # inform the map cross-linking where to find the other maps SitemapGenerator::Sitemap.sitemaps_host = "http://#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com/" # pick a namespace within your bucket to organize your maps SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/' 

adaptör ortam değişkenleri kurulum unutmayın:

ben sis-aws mücevher kullanmak ve sitemap.rb dosyasını yapılandırmak zorunda Site haritasını oluşturmak ve S3'e eklemek? –

+0

S3.It'e olduğu gibi herhangi bir kalıcı dosya sistemi olabilir – sureshprasanna70

İlgili konular