I simply cannot get it to work. I am following the tutorial here: https://github.com/kjvarga/sitemap_generator/wiki/Generate-Sitemaps-on-read-only-filesystems-like-Heroku
I already have the sitemap working locally, however, now I have followed this tutorial I can neither load up the server nor use sitemap commands without errors.
Error:
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:203:in `parse': (C:/Users/Callum/Documents/directory/config/environment_variables.ym
l): found a tab character that violate intendation while scanning a plain scalar at line 5 column 22 (Psych::SyntaxError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:151:in `parse'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:127:in `load'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:297:in `block in load_file'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:297:in `open'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:297:in `load_file'
from C:/Users/Callum/Documents/directory/config/initializers/environment_variables.rb:7:in `block in <class:Application>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.1.1/lib/active_support/lazy_load_hooks.rb:36:in `call'
Sitemap.rb
require 'rubygems'
require 'sitemap_generator'
SitemapGenerator::Sitemap.default_host = "http://www.uk-franchise.co.uk"
SitemapGenerator::Sitemap.sitemaps_host = "http://#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com/"
SitemapGenerator::Sitemap.public_path = 'tmp/'
SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/'
SitemapGenerator::Sitemap.adapter = SitemapGenerator::WaveAdapter.new
SitemapGenerator::Sitemap.create do
add root_path, :lastmod => Time.now, :changefreq => 'weekly', :priority => 1
add posts_path, :lastmod => Time.now, :changefreq => 'weekly', :priority => 1
add events_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_accounting_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_agriculture_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_automotive_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_beverage_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_B2B_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_cafeandcoffee_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_care_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_chemical_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_childrenandbabies_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_cleaning_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_communications_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_computers_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_construction_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_consultancy_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_logistics_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_educationandtraining_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_electrical_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_entertainment_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_enviromental_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_estateagents_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_fashion_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_financial_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_food_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_health_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_hirerental_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_hospitality_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_indoorpropertyservices_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_outdoorpropertyservices_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_internet_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_legal_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_manafacture_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_pets_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_promotional_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_print_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_repairandmaintenance_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_investment1_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_investment2_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_investment3_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
add industry_investment4_path, :lastmod => Time.now, :changefreq => 'monthly', :priority => 1
Post.all.each do |post|
add post_path(post), :lastmod => post.updated_at, :changefreq => 'monthly', :priority => 1
end
Listing.all.each do |listing|
add listing_path(listing), :lastmod => listing.updated_at, :changefreq => 'yearly', :priority => 1
end
end
SitemapGenerator::Sitemap.ping_search_engines # Not needed if you use the rake tasks
Gems
gem 'sitemap_generator'
gem 'carrierwave'
gem 'fog'
Carrierwave.rb
CarrierWave.configure do |config|
config.cache_dir = "#{Rails.root}/tmp/"
config.storage = :fog
config.permissions = 0666
config.fog_credentials = {
:provider => ENV["FOG_PROVIDER"],
:aws_access_key_id => ENV["AWS_ACCESS_KEY_ID"],
:aws_secret_access_key => ENV["AWS_SECRET_ACCESS_KEY"],
}
config.fog_directory = "ukfranchise"
end
environmental_variables file
development:
AWS_ACCESS_KEY_ID: mykey
AWS_SECRET_ACCESS_KEY: mykey
FOG_PROVIDER: AWS
FOG_DIRECTORY: ukfranchise
Any suggestions would be greatly appreciated, banging my head on the desk atm.
Indentation is significant in yaml. In your environment variable file you need to remove the extra level of indentation before the last 3 variables (so that all four variables are at the same level of indentation under the development key). I think that should at least get you past the issue you are seeing above.