Git Product home page Git Product logo

kjvarga / sitemap_generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adamsalter/sitemap_generator

2.4K 2.4K 277.0 1.27 MB

SitemapGenerator is a framework-agnostic XML Sitemap generator written in Ruby with automatic Rails integration. It supports Video, News, Image, Mobile, PageMap and Alternate Links sitemap extensions and includes Rake tasks for managing your sitemaps, as well as many other great features.

License: MIT License

Ruby 100.00%
sitemaps

sitemap_generator's People

Contributors

adamsalter avatar amatsuda avatar apsoto avatar benmorganio avatar brchristian avatar charlespeach avatar coryosborn avatar dlackty avatar dominikgrygiel avatar ehoch avatar envek avatar jasoncodes avatar kjvarga avatar manuelmeurer avatar markprovan avatar rab avatar rarce avatar raviy06 avatar recurser avatar richievos avatar rjhancock avatar sagarjunnarkar avatar samuelpismel avatar scotterc avatar sealocal avatar takatoshi-maeda avatar tiagoamaro avatar tomk32 avatar xymbol avatar yxmatic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sitemap_generator's Issues

Only One Sitemap created and its for localhost:3000?

Hey all,

I'm having this issue: #45 where only one sitemap is created, even though the terminal output shows more.

I'm also only getting the index file to create with localhost:3000 as the address, I've removed and regenerated numerous times from local and for Heroku and I can't for the life of me to get it to work.

Any ideas what might be causing these issues?

Thanks!

Geoff

Usage of i18n_routng gem with sitemap generator

I need to generate sitemap with localized urls. I'm using i18n_routing gem to do translations.
But sitemap generator doesn't know anything about translated paths.

It neither generates routes in my language by defalult (pl)

Article.find_each do |article|
sitemap.add article_path(article), :lastmod => article.updated_at
end

nor generates them when I use helpers provided by i18n_routing gem:

Article.find_each do |article|
sitemap.add pl_article_path(article), :lastmod => article.updated_at
end

In the second case I'm getting 'no method error'.

Is it possible to use this generator with i18n_routing?

Sitemaps are created twice

I am having an issue with v2.0.0. My sitemaps are always created twice.

# config/sitemap.rb
SitemapGenerator::Sitemap.default_host = 'http://google.com'

SitemapGenerator::Sitemap.create do
end

When I execute rake sitemap:create I get the following output:

(in /Users/me/app)
+ sitemap1.xml.gz                   2 links /  762 Bytes /  308 Bytes gzipped
+ sitemap_index.xml.gz           1 sitemaps /  359 Bytes /  198 Bytes gzipped
Sitemap stats: 2 links / 1 sitemaps / 0m00s
+ sitemap2.xml.gz                   0 links /  464 Bytes /  215 Bytes gzipped
+ sitemap_index.xml.gz           1 sitemaps /  359 Bytes /  198 Bytes gzipped
Sitemap stats: 0 links / 1 sitemaps / 0m00s

The generated files contain ungzipped:

public/sitemap_index.xml

<?xml version="1.0" encoding="UTF-8"?><sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>http://google.com/sitemap2.xml.gz</loc></sitemap></sitemapindex>

public/sitemap1.xml

<?xml version="1.0" encoding="UTF-8"?><urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" xmlns:geo="http://www.google.com/geo/schemas/sitemap/1.0"><url><loc>http://google.com/</loc><lastmod>2011-05-31T20:52:48+00:00</lastmod><changefreq>always</changefreq><priority>1.0</priority></url><url><loc>http://google.com/sitemap_index.xml.gz</loc><lastmod>2011-05-31T20:52:48+00:00</lastmod><changefreq>always</changefreq><priority>1.0</priority></url></urlset>

public/sitemap2.xml

<?xml version="1.0" encoding="UTF-8"?><urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" xmlns:geo="http://www.google.com/geo/schemas/sitemap/1.0"></urlset>

When I added some real pathes to sitemap.rb, in general sitemap1.xml included all specified pathes plus root path plus sitemap path whereby sitemap2.xml contained only the specified pathes.

no block given

root@altrove:/rails/lauranovara# rake sitemap:refresh
rake aborted!
no block given

(See full trace by running task with --trace)
root@altrove:/rails/lauranovara#

my config/sitemap.rb looks like :

SitemapGenerator::Sitemap.default_host = "http://lauranovara.com/"
SitemapGenerator::Sitemap.add_links do |sitemap|
sitemap.add '/galleries/jewels'
sitemap.add '/galleries/people'
sitemap.add '/galleries/food'
sitemap.add '/galleries/funny'
sitemap.add '/pages/about'
end

the galleries controller looks like :
class GalleriesController < HomeController
inherit_resources
actions :index, :show
respond_to :html, :xml

caches_page :show
caches_action :index

set the initial the background image

def index
index! do |format|
format.html do
redirect_to gallery_path(@config.galleries.first)
return
end
format.xml { render :template => '/galleries', :layout => false }
end
end

def show
show! do
@page_title = "#{@gallery.title} Gallery"
@page_keywords = @gallery.keywords.blank? ? "#{@gallery.title.downcase}, gallery, photography, portraits, professional" : @gallery.keywords
@page_description = @gallery.description
@galleries = @config.galleries.find :all
render :template => '/gallery'
return
end
end

private #-------
# Defining the collection explicitly for ordering
def collection
@galleries ||= @config.galleries.find :all
end
end

undefined local variable or method `video' for #<SitemapGenerator

Hi,

I've used this sitemap generator before, however I just followed the instructions to create a video sitemap and it gives me the error:
undefined local variable or method `video' for #<SitemapGenerator

The error seems to be coming from the add line when I declare a video hash
add(post_path, :video => {:bla => something, :blah => something else})

Is this a known issue or is there maybe something I have done wrong?

Thanks in advance.

Where is the value of default_host coming from

I have put the following config:
SitemapGenerator::Sitemap.default_host = "http://cheapr.me"

When I generate the site map, the "loc" is coming up as :
http://cheapr.in/
Check -http://cheapr.me/sitemap.xml
I grep'd but there nowhere there is "cheapr.in" in any of the files in my project (I confess that I had originally planned to have my site - cheapr.in) - so unless there is some spooky mind-reading going on, how is the LOC changed to cheapr.in ?

From where is this domain picked up (and why my default_host is ignored ?)

Support for Heroku?

It would be great if you could support read only file systems like Heroku.

const_missing with config.threadsafe!

In production I have config.threadsafe! enabled.
This leads to models not accesible in SitemapGenerator:

SitemapGenerator::Sitemap.add_links do |sitemap|
  Monster.where(:weight => weight).find_each do |m|
    sitemap.add m.path.to_s, :changefreq => 'monthly', :lastmod => m.updated_at, :priority => priority
  end
end

produces

bundle exec rake --trace sitemap:refresh CONFIG_FILE="config/sitemap_monsters.rb" 
** Invoke sitemap:refresh (first_time)
** Invoke sitemap:create (first_time)
** Invoke sitemap:require_environment (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sitemap:require_environment
** Execute sitemap:create
rake aborted!
uninitialized constant Monster
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/ext/module.rb:36:in `const_missing'
config/sitemap_monsters.rb:26:in `block in run'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/sitemap_generator-2.0.1/lib/sitemap_generator/interpreter.rb:47:in `eval'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/sitemap_generator-2.0.1/lib/sitemap_generator/link_set.rb:33:in `create'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/sitemap_generator-2.0.1/lib/sitemap_generator/link_set.rb:43:in `add_links'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/sitemap_generator-2.0.1/lib/sitemap_generator.rb:27:in `method_missing'
config/sitemap_monsters.rb:8:in `run'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/sitemap_generator-2.0.1/lib/sitemap_generator/interpreter.rb:65:in `instance_eval'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/sitemap_generator-2.0.1/lib/sitemap_generator/interpreter.rb:65:in `run'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/sitemap_generator-2.0.1/tasks/sitemap_generator_tasks.rake:41:in `block (2 levels) in <top (required)>'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/bin/rake:19:in `load'
/srv/monsterzoo/shared/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
Tasks: TOP => sitemap:refresh => sitemap:create

The only workaround is to disable threadsafety for rake tasks in my environment:

config.threadsafe! unless $rails_rake_task

uninitialized constant SitemapGenerator

Even in a brand new rails application, SitemapGenerator fails to run any rake tasks. Maybe I'm doing something wrong but:

$ rails sitemap
$ cd sitemap
$ script/plugin install git://github.com/kjvarga/sitemap_generator.git
$ rake --trace sitemap:install

And I get the uninitialized constant error found here:
http://pastie.org/1048786

This is a bare rails app with nothing in it, Rails version 2.3.2

generation runs twice

I've installed the gem and plugin according to the README. I'm generating eleven sitemaps without error, however they are being generated twice.

clash with less

There seems to be a clash with the less 1.2.20 on the 'verbose' method. If I run any rake task that makes a reference to verbose I get the following error:

no block given
from /opt/local/lib/ruby/gems/1.8/gems/less-1.2.20/lib/less/ext.rb:28:in `verbose'

Rails 2.3.5 with bundler / email executed from rake errors

I am running Rails 2.3.5 with bundler 0.9.26. If we don't include the code for the Rakefile we don't get access to the sitemap rake tasks. Having the code in the Rakefile causes all emails fired from rake tasks to throw this error:

undefined method `url_for' for #ActionView::Base:0x104d86eb8

Unable to specify sitemaps_path

I'm specify in top of config/sitemap.rb
SitemapGenerator::Sitemap.sitemaps_path = "sitemap"

but self.sitemaps_path is nil anyway.

Allowing the inclusion of old files for incremental generation of sitemap

@tulios writes:

In my current project we have a huge amount of links and videos to generate sitemap, but the big
problem is that we have a lot of links and videos every day because of that we decide to make the build of the sitemap daily.

Is possible to configure the start index of the namer, however the sitemap index is generated without the old files. I know this
is very specific of my project but I am pulling back, maybe some one have the same problem.

The usage is:

...
group(sitemaps_namer: my_namer, include_all_files: true) do
...
end

We pass an option :include_all_files and the generation of sitemap index will take in count the numbers before the start value.

...
my_namer = SitemapGenerator::SitemapNamer.new("my-sitemap", start: 3)
...
group(sitemaps_namer: my_namer, include_all_files: true) do
...
end

In the index we will have
...

http://site/my-sitemap1.xml.gz

http://site/my-sitemap2.xml.gz

http://site/my-sitemap3.xml.gz

subdomain routing support?

Chris writes:

I've been using sitemap_generator for a while now, and I like it.
I recently changed my Rails app from a traditional subdirectory routing architecture to a subdomain-based routing (like Basecamp and others. See 37-Signals: How to do Basecamp-style subdomains in Rails)
I was wondering if you would consider adding support for generating sitemaps for subdomain-based routing. I realize that subdomains kind of defeat the purpose of sitemaps.

Thoughts?

Allow an extra step before pinging search engines

During our sitemap building, we'd like to RSync our sitemap out to our servers before pinging the search engines.

What do you think the best way to do that is? I'd rather a built-in solution, rather than forking our own copy and modifying it to include our step.

Exception handling

We were using crontab, and at one point one of our path method was removed, and we forgot to change the sitemap.rb and it was silently failing.

When I found that and fix the sitemap I added a simple exception catcher for it.

SitemapGenerator::Sitemap.create do
  begin
    # ... code ...
  rescue Exception => e
    puts e.message
    HoptoadNotifier.notify(e, :component => 'Sitemap Generator')
  end
end

But I was wondering if there is a better way to this already integrated in the gem. And if there isn't can I add a point for extending with exception handlers.

Yahoo Sitemap URL

Might need to update the old url for yahoo sitemap url from:

"http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=#{sitemap_index_url}&appid=#{yahoo_app_id}",

to

"http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=#{yahoo_app_id}&url=#{sitemap_index_url}"

The "ping" path now returns "The service has been shut down. For further details, please see the Deprecated Services blog post http://developer.yahoo.com/blogs/ydn/posts/2010/08/api_updates_and_changes"

undefined method `link_to'

Is there a way to define non-resrouceful paths? I only see examples for resourceful paths

I however would like to work with paths like these:

link_to location_item.name, :controller => '/location_items', :action => 'display', :location_name => name_to_url(location.name), :location_item_name => name_to_url(location_item.name), :id => location_item.id

Sitemap for multiple domain

I have a rails 2.3.2 application which handles around 5 domains. I just can't figure out how to use well. I need to create a new rake task to generate sitemap for a domain, put it in a separate folder. I need a rake task to generate sitemap for all domains, put them in a separate folder (for each domain).

Any idea?

Sitemap too big! The uncompressed size exceeds 10Mb

Sitemap generation has been working for weeks. Suddenly today:

...
+ /data/mysite/releases/20100526223320/public/sitemap25.xml.gz
+ /data/mysite/releases/20100526223320/public/sitemap26.xml.gz
+ /data/mysite/releases/20100526223320/public/sitemap27.xml.gz
+ /data/mysite/releases/20100526223320/public/sitemap28.xml.gz
** Sitemap too big! The uncompressed size exceeds 10Mb
+ /data/mysite/releases/20100526223320/public/sitemap29.xml.gz
+ /data/mysite/releases/20100526223320/public/sitemap30.xml.gz
+ /data/mysite/releases/20100526223320/public/sitemap31.xml.gz
+ /data/mysite/releases/20100526223320/public/sitemap32.xml.gz
+ /data/mysite/releases/20100526223320/public/sitemap_index.xml.gz
Sitemap stats: 1,554,832 links, 584m21s

I'm not sure why that would happen, since splitting the sitemaps in to different files is up to sitemap_generator. The maximum length of any url in the sitemap28.xml file is 308 characters.

Broken gemspec

Is README.md.orig supposed to be in there? I'm getting this error:

sitemap_generator at /...snip.../sitemap_generator-7b26f576c155 did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
["README.md.orig"] are not files

Sitemap namespaces

Hi dear sitemap generators,

For some reason, we might want to create distinct sitemaps according to their content type, or simply cause of some organization constraints. It would be then great to have the possibility to define namespaces, each one of them including its own set of urls.

Something like that in the sitemap.rb:

SitemapGenerator::Sitemap.namespace(:posts) do 
  SitemapGenerator::Sitemap.add_links do |sitemap|
    sitemap.add(...)
  end
end

SitemapGenerator::Sitemap.namespace(:videos) do 
  SitemapGenerator::Sitemap.add_links do |sitemap|
    sitemap.add(...)
  end
end

would generate sitemaps files like:

sitemap_index.xml
sitemap_posts1.xml
sitemap_videos1.xml
...

Thanks for your feedbacks :)

No such file or directory

Running a Rails 2.2.2 App.

If you see it having trouble finding the sitemap.rb file like this:

No such file or directory - /Users/me/code/MyRailsAppconfig/sitemap.rb

You can just add a / to line 24 of lib/sitemap_generator/interpreter.rb

Multiple videos support

Hi,

Following monkey-patch adds support for multiple videos.
Instead of:
add path, :video => video1_hash
use:
add path, :videos => [video1_hash, video2_hash, video3_hash]

# Paste this into config/initilizers/sitemap_multiple_videos.rb

module SitemapGenerator
  module Builder
    class SitemapUrl < Hash

      # Call with:
      #   sitemap - a Sitemap instance, or
      #   path, options - a path for the URL and options hash
      def initialize(path, options={})
        if sitemap = path.is_a?(SitemapGenerator::Builder::SitemapFile) && path
          options.reverse_merge!(:host => sitemap.location.host, :lastmod => sitemap.lastmod)
          path = sitemap.location.path_in_public
        end

        SitemapGenerator::Utilities.assert_valid_keys(options, :priority, :changefreq, :lastmod, :host, :images, :videos, :geo, :news)
        options.reverse_merge!(:priority => 0.5, :changefreq => 'weekly', :lastmod => Time.now, :images => [], :news => {})
        self.merge!(
          :path => path,
          :priority => options[:priority],
          :changefreq => options[:changefreq],
          :lastmod => options[:lastmod],
          :host => options[:host],
          :loc => URI.join(options[:host], path).to_s,
          :images => prepare_images(options[:images], options[:host]),
          :news => prepare_news(options[:news]),
          :videos => options[:videos],
          :geo => options[:geo]
        )
      end

      # Return the URL as XML
      def to_xml(builder=nil)
        builder = ::Builder::XmlMarkup.new if builder.nil?
        builder.url do
          builder.loc        self[:loc]
          builder.lastmod    w3c_date(self[:lastmod])   if self[:lastmod]
          builder.changefreq self[:changefreq]          if self[:changefreq]
          builder.priority   self[:priority]            if self[:priority]

          unless self[:news].blank?
            news_data = self[:news]
            builder.news:news do
              builder.news:publication do
                builder.news :name, news_data[:publication_name] if news_data[:publication_name]
                builder.news :language, news_data[:publication_language] if news_data[:publication_language]
              end

              builder.news :access, news_data[:access] if news_data[:access]
              builder.news :genres, news_data[:genres] if news_data[:genres]
              builder.news :publication_date, news_data[:publication_date] if news_data[:publication_date]
              builder.news :title, news_data[:title] if news_data[:title]
              builder.news :keywords, news_data[:keywords] if news_data[:keywords]
              builder.news :stock_tickers, news_data[:stock_tickers] if news_data[:stock_tickers]
            end
          end


          unless self[:images].blank?
            self[:images].each do |image|
              builder.image:image do
                builder.image :loc, image[:loc]
                builder.image :caption, image[:caption]             if image[:caption]
                builder.image :geo_location, image[:geo_location]   if image[:geo_location]
                builder.image :title, image[:title]                 if image[:title]
                builder.image :license, image[:license]             if image[:license]
              end
            end
          end

          unless self[:videos].blank?
            self[:videos].each do |video|
              builder.video :video do
                builder.video :thumbnail_loc, video[:thumbnail_loc]
                builder.video :title, video[:title]
                builder.video :description, video[:description]
                builder.video :content_loc, video[:content_loc]           if video[:content_loc]
                if video[:player_loc]
                  builder.video :player_loc, video[:player_loc], :allow_embed => (video[:allow_embed] ? 'yes' : 'no'), :autoplay => video[:autoplay]
                end

                builder.video :rating, video[:rating]                     if video[:rating]
                builder.video :view_count, video[:view_count]             if video[:view_count]
                builder.video :publication_date, video[:publication_date] if video[:publication_date]
                builder.video :expiration_date, video[:expiration_date]   if video[:expiration_date]
                builder.video :family_friendly, (video[:family_friendly] ? 'yes' : 'no')  if video[:family_friendly]
                builder.video :duration, video[:duration]                 if video[:duration]
                video[:tags].each {|tag| builder.video :tag, tag }        if video[:tags]
                builder.video :tag, video[:tag]                           if video[:tag]
                builder.video :category, video[:category]                 if video[:category]
                builder.video :gallery_loc, video[:gallery_loc]           if video[:gallery_loc]

                if video[:uploader]
                  builder.video :uploader, video[:uploader], video[:uploader_info] ? { :info => video[:uploader_info] } : {}
                end
              end
            end
          end

          unless self[:geo].blank?
            geo = self[:geo]
            builder.geo :geo do
              builder.geo :format, geo[:format] if geo[:format]
            end
          end
        end
        builder << '' # Force to string
      end
    end
  end
end

Sitemaps with less than 50,000 urls still use sitemap index

When I create a sitemap with less than 50,000 urls, it should not use a sitemap index file. I personally run multiple sitemaps for my sites, including a small news-only one, and the idea of a sitemap index file for a sitemap with 20 urls seems silly. Other than that I love this project and think it will be perfect.

Could anyone spearhead fixing? Willing to donate for this!

Not able to load the sitemap into the AWS root

Hi all,

I would like to upload the sitemap_index and the sitemap into the root of the AWS bucket (as opposed to a subdirectory -- see the wiki example).

I tried to set the sitemaps_path to "" or "/" but in the first case a subdirectory named "." is created on S3, in the second case a directory without name is created.

Is there a way I can use to save the files to the root directory of the bucket?

Thanks in advance.

Paul

Don't modify options object given to #add

This line: https://github.com/kjvarga/sitemap_generator/blob/master/lib/sitemap_generator/link_set.rb#L130 changes the given options instead of creating a new object.

The problem (other than violating the principle to never modify objects that you didn't create) is that, when I have code like this:

default_site_options = { :changefreq => 'daily', :priority => 0.5, :lastmod => nil }.freeze

SitemapGenerator::Sitemap.create do
  add some_url, default_site_options

it returns my default_site_options object as:

{:news=>{}, :lastmod=>nil, :priority=>0.5, :videos=>[], :images=>[], :host=>"http://www.sofatutor.com", :changefreq=>"daily"}

When I then continue adding videos:

  Video.all.each do |video|
    add video.video_url, default_site_options.merge(:video => video.sitemap_tags)
  end

the videos array fills up with more and more videos:

{:news=>{}, :lastmod=>nil, :priority=>0.5, :videos=>[{:gallery_loc=>"http://localhost:3000/mathematik/verschiedenes/wichtige-konstanten", :category=>"Mathematik", :publication_date=>"2009-03-09T02:47:49+01:00", :price=>nil, :uploader=>"Konstantin E", :title=>"Irrationalität der Eulerschen Zahl e", :expiration_date=>nil, :description=>"Hier wird der Beweis dafür geführt, dass die Eulersche Zahl e tatsächlich irrational, also nicht als Bruch schreibbar ist. Dieses Videos erklärt eulersche zahl e, rational, irrational, beweis und reihendarstellung. Nachhilfe in Mathematik mit Lernvideos und Testfragen findest du auf http://localhost:3000/mathematik.", :tags=>["Video", "Nachhilfe", "Lernen", "Vorbereitung", "Klausuren", "Tests", "Lernvideo", "Üben", "Lernen", "Erklärung", "Anleitung", "eulersche zahl e", "rational", "irrational", "beweis", "reihendarstellung"], :duration=>203, :content_loc=>nil, :family_friendly=>true}], :images=>[], :host=>"http://www.sofatutor.com", :changefreq=>"daily"}```

…which means I get a wrong sitemap (and a quite large one, too.)

Sitemap index only includes first sitemap

Having an issue where my sitemap index generates only one item in the XML. The stats however correctly output the 6 elements.

Here's the task output:

  • sitemaps/com/sitemap1.xml.gz 7392 links / 10 MB / 595 KB gzipped
  • sitemaps/com/sitemap2.xml.gz 4117 links / 10 MB / 565 KB gzipped
  • sitemaps/com/sitemap3.xml.gz 3916 links / 10 MB / 545 KB gzipped
  • sitemaps/com/sitemap4.xml.gz 31588 links / 10 MB / 697 KB gzipped
  • sitemaps/com/sitemap5.xml.gz 50000 links / 7.51 MB / 692 KB gzipped
  • sitemaps/com/sitemap6.xml.gz 21965 links / 3.32 MB / 294 KB gzipped
  • sitemaps/com/sitemap_index.xml.gz 6 sitemaps / 848 Bytes / 238 Bytes gzipped

And the content of the generated index:

<?xml version="1.0" encoding="UTF-8"?><sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>http://roomorama.s3.amazonaws.com/sitemaps/com/sitemap1.xml.gz</loc></sitemap></sitemapindex>

Issue with Rails 3.0.3

I'm having trouble using this generator.
Here's my config:
SitemapGenerator::Sitemap.default_host = 'http://www.mysite.com'
SitemapGenerator::Sitemap.add_links do |sitemap|

sitemap.add restaurants_path
Restaurant.find_each do |r|
    sitemap.add restaurant_path(r), :lastmod => r.updated_at
end
end

When I execute 'rake sitemap:refresh' I get:
rake aborted!
undefined method `>=' for nil:NilClass

If I remove the 'find_each' block, leaving just the first line (sitemap.add restaurants_path) then it works.
Also, I can use restaurant_path with no problems on my website.

Here's the full trace:

** Invoke sitemap:refresh:no_ping (first_time)
** Invoke sitemap:create (first_time)
** Invoke sitemap:require_environment (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sitemap:require_environment
** Execute sitemap:create
rake aborted!
undefined method >=' for nil:NilClass /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/whiny_nil.rb:48:inmethod_missing'
/usr/lib/ruby/1.8/rational.rb:526:in **' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.1/lib/action_view/helpers/number_helper.rb:269:innumber_with_precision'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.1/lib/action_view/helpers/number_helper.rb:347:in number_to_human_size' /usr/lib/ruby/gems/1.8/gems/sitemap_generator-1.3.7/lib/sitemap_generator/builder/sitemap_file.rb:141:insummary'
/usr/lib/ruby/gems/1.8/gems/sitemap_generator-1.3.7/lib/sitemap_generator/link_set.rb:33:in create' /usr/lib/ruby/gems/1.8/gems/sitemap_generator-1.3.7/tasks/sitemap_generator_tasks.rake:41 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:incall'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:ininvoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:ininvoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

Thank you and keep up the good work :)

Pass information to block

Dear gem owner!

Thank you for nice gem. I am using it at few projects and happy but had a problem with one project. I should pass custom information into block to generate sitemap. My application contains a few independent website and should create an independent sitemap for each website. Here is little code that illustrates how I do it:
Website.find(:all).each do |website|
@website_id = website.id
@website = website

puts 'test1 - @website_id ' + @website_id.inspect + " context: " + self.inspect
SitemapGenerator::Sitemap.default_host = @website.domain
SitemapGenerator::Sitemap.public_path = "tmp/"
SitemapGenerator::Sitemap.sitemaps_path = "sitemaps/#{@website.code}"
SitemapGenerator::Sitemap.adapter = SitemapGenerator::WaveAdapter.new
SitemapGenerator::Sitemap.create do
  puts 'test2 - @website_id ' + @website_id.inspect + " context: " + self.inspect
  add "/home"
  add "/welcome"
end

end

and here is output:
test1 - @website_id 1 context: #<struct ExportSitemapJob job_id={:admin_job_id=>22, :website_id=>3}, website_id=nil>
test2 - @website_id nil context: #<SitemapGenerator::Interpreter:0x3605fe8 @linkset=#<SitemapGenerator::LinkSet:0x350ff58 @include_root=true, @include_index=true, @filename=:sitemap, @verbose=false, @default_host="www.example.org", @public_path=#Pathname:XXX/tmp/, @sitemaps_path="sitemaps/wellness", @adapter=, @sitemaps_namer=sitemap1.xml.gz, @added_default_links=false, @interpreter=#<SitemapGenerator::Interpreter:0x3605fe8 ...>, @sitemap=nil, @sitemap_index_namer=sitemap_index.xml.gz, @sitemap_index=nil>>
that illustrate that context and different. I used code like this:

SitemapGenerator::Sitemap.create :yield_sitemap => true do |interpreter|
interpreter.add “/home”
interpreter.add “/welcome”
end
but has result: undefined method `yield_sitemap=' for #
Can I pass some information to block? I think this would be useful for some tasks and would be great to have example at documentation that illustrates how to result this task.

This is questions or request for documentation rather than bug, but I wasn't able to find this category at github bug tracking system.

Sincerely yours,
Artem Rufanov.

rake sitemap:refresh "rake aborted! wrong number of arguments (1 for 0)"

Hi, I've installed the gem via git like this
gem "sitemap_generator", :git => "git://github.com/kjvarga/sitemap_generator.git"

then I've run:
rake sitemap:install

I've edited my sitemap.rb which is like this:

# Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = "http://www.example.com"
SitemapGenerator::Sitemap.sitemaps_path = 'system/sitemaps'

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

Then run:
rake sitemap:refresh:no_ping --trace

The rake task is failing. It looks like that I have some wrong xml lib or something... I'm very new to ruby sorry :S. This is the stack trace output:

shevany:entretenerse mauroasprea$ rake sitemap:refresh:no_ping --trace
** Invoke sitemap:refresh:no_ping (first_time)
** Invoke sitemap:create (first_time)
** Invoke sitemap:require_environment (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sitemap:require_environment
** Execute sitemap:create
rake aborted!
wrong number of arguments (1 for 0)
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/builder-3.0.0/lib/builder/xmlbase.rb:135:in to_xs' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/builder-3.0.0/lib/builder/xmlbase.rb:135:in_escape'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/builder-3.0.0/lib/builder/xmlbase.rb:88:in text!' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/builder-3.0.0/lib/builder/xmlbase.rb:76:inmethod_missing'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bundler/gems/sitemap_generator-386551f3221e/lib/sitemap_generator/builder/sitemap_url.rb:61:in to_xml' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/builder-3.0.0/lib/builder/xmlbase.rb:155:incall'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/builder-3.0.0/lib/builder/xmlbase.rb:155:in _nested_structures' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/builder-3.0.0/lib/builder/xmlbase.rb:63:inmethod_missing'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bundler/gems/sitemap_generator-386551f3221e/lib/sitemap_generator/builder/sitemap_url.rb:60:in to_xml' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bundler/gems/sitemap_generator-386551f3221e/lib/sitemap_generator/builder/sitemap_file.rb:82:inadd'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bundler/gems/sitemap_generator-386551f3221e/lib/sitemap_generator/link_set.rb:322:in add_default_links' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bundler/gems/sitemap_generator-386551f3221e/lib/sitemap_generator/link_set.rb:118:inadd'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bundler/gems/sitemap_generator-386551f3221e/lib/sitemap_generator/interpreter.rb:31:in add' /Users/mauroasprea/entretenerse/config/sitemap.rb:6:inrun'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bundler/gems/sitemap_generator-386551f3221e/lib/sitemap_generator/interpreter.rb:49:in instance_eval' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bundler/gems/sitemap_generator-386551f3221e/lib/sitemap_generator/interpreter.rb:49:ineval'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bundler/gems/sitemap_generator-386551f3221e/lib/sitemap_generator/link_set.rb:36:in create' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bundler/gems/sitemap_generator-386551f3221e/lib/sitemap_generator.rb:31:insend'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bundler/gems/sitemap_generator-386551f3221e/lib/sitemap_generator.rb:31:in method_missing' /Users/mauroasprea/entretenerse/config/sitemap.rb:5:inrun'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bundler/gems/sitemap_generator-386551f3221e/tasks/sitemap_generator_tasks.rake:41
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/task.rb:205:in call' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/task.rb:205:inexecute'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/task.rb:200:in each' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/task.rb:200:inexecute'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/task.rb:158:in invoke_with_call_chain' /Users/mauroasprea/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/monitor.rb:242:insynchronize'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/task.rb:151:in invoke_with_call_chain' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/task.rb:176:ininvoke_prerequisites'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/task.rb:174:in each' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/task.rb:174:ininvoke_prerequisites'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/task.rb:157:in invoke_with_call_chain' /Users/mauroasprea/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/monitor.rb:242:insynchronize'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/task.rb:151:in invoke_with_call_chain' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/task.rb:144:ininvoke'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/application.rb:116:in invoke_task' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/application.rb:94:intop_level'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/application.rb:94:in each' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/application.rb:94:intop_level'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/application.rb:133:in standard_exception_handling' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/application.rb:88:intop_level'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/application.rb:66:in run' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/application.rb:133:instandard_exception_handling'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/lib/rake/application.rb:63:in run' /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/gems/rake-0.9.2.2/bin/rake:33 /Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bin/rake:19:inload'
/Users/mauroasprea/.rvm/gems/ruby-1.8.7-p352@entretenersetesting/bin/rake:19
Tasks: TOP => sitemap:refresh:no_ping => sitemap:create

Add link to other pre-generated sitemaps

Hi, it has been a pleasure to use this nice gem.

I had this issue tonight where I have two sitemaps I need to include in my sitemap_index.xml.gz file, but only one of which is generated by sitemap_generator. Is there a way to just "link" to a second sitemap? I couldn't figure it out and didn't see this issue discussed in this issues database so I am posting here. I tried using an empty group but nothing seems to get generated since I didn't add any links to the group.

The reason why I do this is because my main site is ruby/rails at website.com and I have my wordpress php blog at website.com/blog. The wordpess blog sitemap can't be created by this gem. So I've given up and allow a wordpress plugin to create the blog sitemap and I just want to link to it in the sitemap_index.xml.gz along with the link to the main site's sitemap.

One workaround would be for me to put my blog at blog.website.com, but my entire site is SSL and (correct me if I'm wrong), but I didn't want to buy 2 certificates, one for website.com and one for blog.website.com. Besides, I prefer it at /blog anyway.

My actual current workaround is to manually create a sitemap_index.xml file. Then after a capistrano deploy, I have a task to remove the sitemap_generator-created sitemap_index.xml.gz file and then I gzip my sitemap_index.xml file to take its place. There's a slight race condition in this case as the refresh has already sent out the pings to alert search engine robots and then I do the rm and cp/gzip for my real index file but whatever.

Thoughts? Could we add a link_only attribute for a new group or have an add_index_file method?

Ping search engines require login

Hello,

Thank you very much for gem, I use it and like it.

I see that some search engine require login (authorization) before ping. For example: http://webmaster.yandex.ru/wmconsole/sitemap_list.xml?host=http://www.example.com%2Fsitemap_index.xml.gz requires authorization. How can I handle this situation from sitemap generator. Are you planning to add credentials to handle this case?

Also it would be great to allow ping search engines behind proxy including ntlm (gem "ruby-ntlm", ">= 0.0.1" ) proxy.

I am ready to participate and test.

Sincerely yours,
Artem Rufanov.

P.S.
Have a good day!

can't convert nil into String - rails 3.0.4

getting error "can't convert nil into String"

full trace

can't convert nil into String
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/sitemap_generator-1.3.1/lib/sitemap_generator/link_set.rb:60:in join' /Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/sitemap_generator-1.3.1/lib/sitemap_generator/link_set.rb:60:ininitialize'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/sitemap_generator-1.3.1/lib/sitemap_generator.rb:21:in new' /Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/sitemap_generator-1.3.1/lib/sitemap_generator.rb:21:inblock in module:SitemapGenerator'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.4/lib/active_support/core_ext/kernel/reporting.rb:11:in block in silence_warnings' /Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.4/lib/active_support/core_ext/kernel/reporting.rb:22:inwith_warnings'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.4/lib/active_support/core_ext/kernel/reporting.rb:11:in silence_warnings' /Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/sitemap_generator-1.3.1/lib/sitemap_generator.rb:14:inmodule:SitemapGenerator'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/sitemap_generator-1.3.1/lib/sitemap_generator.rb:9:in <top (required)>' /Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:inrequire'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in block (2 levels) in require' /Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:ineach'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in block in require' /Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:ineach'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in require' /Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.7/lib/bundler.rb:112:inrequire'
/Users/omar/Proyectos/AlfonsoParra/aparra/config/application.rb:7:in <top (required)>' <internal:lib/rubygems/custom_require>:29:inrequire'
internal:lib/rubygems/custom_require:29:in require' /Users/omar/Proyectos/AlfonsoParra/aparra/Rakefile:4:in<top (required)>'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2383:in load' /Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2383:inraw_load_rakefile'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2017:in block in load_rakefile' /Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2016:in load_rakefile' /Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2000:inblock in run'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:1998:inrun'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/bin/rake:31:in <top (required)>' /Users/omar/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:inload'
/Users/omar/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `

'

Sitemap file generation should use binary mode

Hello,

Sitemap generator should use binary mode for file generation since under Windows it will generate a text based file.

A simple change from 'w' to 'wb' fix the problem.

Thank you.

ruby 1.8.6 does not have bytesize

I had to change bytesize to .length to make this work in 1.8.6. I think the changes to how strings are handled comes in ruby 1.9

not sure if there is an elegant fix to this to make this plugin compatible across all ruby versions...

rake aborts on any task, when sitemap_generator is included in rakefile

I traced a problem with rake aborting (rake aborted! undefined method text_area' for classActionView::Base') down to the point, that when I uncomment the Rakefile entry for sitemap_generator it works just fine... - My guess is, that things are being pulled in the wrong order. Can you make sense of that?

Can't modify frozen object when running rake sitemap:refresh

I have moved from using the gem to installing a plugin. Now i'm getting this error. Thank you for your help.

javier@javier-laptop:~/Projects/tareas_site$ rake sitemap:refresh --trace
(in /home/javier/Documents/Projects/Freelancing/OasicTech/tareas_site)
** Invoke sitemap:refresh (first_time)
** Invoke sitemap:create (first_time)
** Invoke environment (first_time)
** Execute environment

** Execute sitemap:create

  • /sitemap1.xml.gz 16 links / 2.7 KB / 422 Bytes gzipped

Sitemap stats: 16 links / 1 files / 0m00s
rake aborted!
can't modify frozen object
/usr/lib/ruby/gems/1.8/gems/sitemap_generator-0.3.3/lib/sitemap_generator/builder/sitemap_file.rb:76:in filesize=' /usr/lib/ruby/gems/1.8/gems/sitemap_generator-0.3.3/lib/sitemap_generator/builder/sitemap_file.rb:76:in<<'
/usr/lib/ruby/gems/1.8/gems/sitemap_generator-0.3.3/lib/sitemap_generator/link_set.rb:93:in new_sitemap' /usr/lib/ruby/gems/1.8/gems/sitemap_generator-0.3.3/lib/sitemap_generator/link_set.rb:110:infinalize!'
/usr/lib/ruby/gems/1.8/gems/sitemap_generator-0.3.3/lib/sitemap_generator/link_set.rb:25:in create' /usr/lib/ruby/gems/1.8/gems/sitemap_generator-0.3.3/tasks/sitemap_generator_tasks.rake:28 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:incall'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:ininvoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:ininvoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

undefined method "verbose" when refreshing sitemap

[riding@host equine]$ cd /home/riding/railsapps/equine && /usr/bin/rake -t sitemap:refresh RAILS_ENV=production
(in /home/riding/railsapps/equine)
** Invoke sitemap:refresh (first_time)
** Invoke sitemap:create (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke sitemap:clean (first_time)
** Invoke environment
** Execute sitemap:clean
** Execute sitemap:create

  • /home/riding/railsapps/equine/public/sitemap1.xml.gz
  • /home/riding/railsapps/equine/public/sitemap_index.xml.gz
    Sitemap stats: 19,785 links, 0m12s
    rake aborted!
    undefined method verbose=' for #<SitemapGenerator::LinkSet:0xb78a859c> /home/riding/railsapps/equine/vendor/plugins/sitemap_generator/tasks/sitemap_generator_tasks.rake:36 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:incall'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:ineach'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:ininvoke_with_call_chain'
    /usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:ineach'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:ininvoke_with_call_chain'
    /usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:ineach'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:inrun'
    /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
    /usr/bin/rake:16:in `load'
    /usr/bin/rake:16

Add ping servers

Hi, Karl!

Thank you for awesome gem. I am using it for my project, and have one question :). Is it possible to add other ping servers additional to basic. That will be notified after refresh task.

Thanks,
Vlad

something wrong with installation (stack level too deep)

Hi!

Thanks for great gem!!!

Please help me get this working

ruby 1.8.7 (2011-06-30 patchlevel 352)
Rails 2.3.5
sitemap_generator (2.1.6)

I tried installation from gem and plug-in
All of them failed to refresh with error

stack level too deep
(DELEGATE):2:in set_options' (__DELEGATE__):2:insend'
(DELEGATE):2:in set_options' (__DELEGATE__):2:insend'
(DELEGATE):2:in set_options' (__DELEGATE__):2:insend'
(DELEGATE):2:in set_options' (__DELEGATE__):2:insend'
(DELEGATE):2:in set_options' (__DELEGATE__):2:insend'

Do you know how to deal with it?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.