Comments (9)
Hi there,
It sounds like you are running an older version of SitemapGenerator. Or at least the tasks file that is being used could be old. Can you make sure that there isn't a plugin version in your application's vendor/plugins and confirm that it is using v2.0.0 when running the rake tasks (best is to use bundler and run with bundle exec).
I'm not seeing this behaviour with Rails 3.0.7 test app. What version of Rails are you running?
from sitemap_generator.
I just set up a new Rails 3.0.7 test app and the same thing happens. Even the rake sitemap:install
generator seems to run twice:
~/apps/sitemap_generator_test bundle exec rake sitemap:install
(in /Users/me/apps/sitemap_generator_test)
created: config/sitemap.rb
already exists: config/sitemap.rb, file not copied
I am using Ruby 1.9.2-p180 and RVM.
There is no Sitemap Generator plugin or old version installed anywhere... very strange.
from sitemap_generator.
The same happens for me with Rake 0.9.0 instead of 0.8.7 and with Rails versions 3.0.6, 3.0.8.rc4 and 3.1.0.rc1.
Also, it happens on the production server (Ubuntu 8.04), so I doubt it's a problem with an installed legacy version or similar. It must be my configuration or combination of gems, but I'm not seeing it. Can somebody else please try to confirm this?
from sitemap_generator.
Can you pull from https://github.com/kjvarga/sitemap_generator-test and run your tests and see what you get? The README shows my output running under Ruby 1.9.2. It is a Rails 3.0.7 app. Running under REE 1.8.7 also works as expected.
Also run bundle show sitemap_generator
in your failing apps just to double-check that the v2.0.0 gem is being used. I get ouput like this:
[karl@karl-vargas-macbook-pro sg-test (master)]$ bundle show sitemap_generator
/Users/karl/.rvm/gems/ruby-1.9.2-p180/gems/sitemap_generator-2.0.1
BTW I just pushed v2.0.1. It just contains a couple minor fixes...nothing related to your issue.
from sitemap_generator.
Alright, that did the trick. It was my fault after all... :(
I cloned the test app and got the same results as you did. So I went ahead and added the require 'sitemap_generator/tasks'
to the Rakefile in the test app as I did in my app where the error originally appeared, at which time I noticed in the README it should just be done for Rails 2. As soon as I removed the require from the Rakefile, everything worked normally.
I had a quick look at the SG tasks file but couldn't see what makes it execute everything twice if it's included twice (normal behavior?). Maybe there is a quick way to fix this in case other people make the same mistake as me?
Thanks for your quick help in this matter and a great gem! :)
from sitemap_generator.
Thanks Manuel :) Glad you like the gem, and that you got it sorted out. I thought about the Rakefile but dismissed it because I figured that it would not require that file twice...but now it makes sense. In Rails 3 the tasks are added using a Railtie, so the require in the Rakefile will cause the tasks file to be loaded (again). Now I think the documented behaviour of Rake is that when you define a task's dependencies, if the task already has deps defined, the dependencies are added to the existing deps...so I can see how rake sitemap:refresh
which depends on sitemap:create
could run the create tasks twice. But if you call sitemap:create
directly I would expect it to have only run it once. I guess Rake must be doing something that I don't understand yet....
from sitemap_generator.
I got the same issue now
I am using
Ruby 2.3.1 (MRI)
Rails 4.2.7.1
Sitemap generator 5.2.0
I put the following code in /config/sitemap.rb
:
puts "rake task: #{Rake::Task["sitemap:create"].actions}"
Result:
rake task: [#<Proc:0x007f9bd50d1498@/users/pikachuexe/.rvm/gems/ruby-2.3.3/gems/sitemap_generator-5.2.0/lib/sitemap_generator/tasks.rb:50>, #<Proc:0x007f9bd2f8c490@/users/pikachuexe/.rvm/gems/ruby-2.3.3/gems/sitemap_generator-5.2.0/lib/sitemap_generator/tasks.rb:50>]
rake task: [#<Proc:0x007f9bd50d1498@/users/pikachuexe/.rvm/gems/ruby-2.3.3/gems/sitemap_generator-5.2.0/lib/sitemap_generator/tasks.rb:50>, #<Proc:0x007f9bd2f8c490@/users/pikachuexe/.rvm/gems/ruby-2.3.3/gems/sitemap_generator-5.2.0/lib/sitemap_generator/tasks.rb:50>]
I wonder if it's due to
https://github.com/kjvarga/sitemap_generator/blob/master/lib/tasks/sitemap_generator_tasks.rake#L1
is using load
not require
from sitemap_generator.
For anyone getting this recently, I'm getting it on ruby 3 and sitemap_generator 6.
The answer is you don't need to include anything in your Rakefile. If you include it then it generates it twice...
from sitemap_generator.
@9mm
Thanks
I just read README again and found that it's mentioned already... 😬
from sitemap_generator.
Related Issues (20)
- Ping failed for Bing: #<OpenURI::HTTPError: 410 Gone> HOT 2
- Feature Request: Remove unwanted options HOT 6
- Is it possible to override the default link options? HOT 3
- How to remove default priority, lastmod and changefreq from all urls HOT 1
- GoogleStorageAdapter - Can't create sitemap on buckets with uniform bucket-level access enabled HOT 3
- Allow disable acl for S3 bucket HOT 1
- Rails on Heroku with S3 sitemap hosting - google didn't like it HOT 2
- 【Worked】Ping failed for Bing: #<OpenURI::HTTPError: 410 Gone> HOT 4
- Is it possible to add additional metadata fields to the xml HOT 5
- Feature request : Make `default_host` optional / Allow full URL instead of path HOT 2
- Entity escaping in XML output
- google search console couldn't fetch sitemap but index is ok HOT 7
- Google search correct ping url HOT 2
- Readme install instructions fail HOT 1
- [BUG] Mobile sitemap link in Readme.md is giving 404
- TimeZone is ignored
- sitemap.xml.gz file not found on server
- Testing with frozen time does not work
- should sitemap show up automatically in google search console? HOT 2
- Should we drop default `lastmod` of `Time.now` as Google says "it needs to consistently match reality"? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sitemap_generator.