Comments (7)
Hi there,
You can do what you want to with something like the following. You may need to pass more options in the call to add to set the host, depending on your setup.
SitemapGenerator.yield_sitemap = true
SitemapGenerator::Sitemap.create do |sm|
sm.sitemap_index.add '/theirsitemap.xml.gz'
sm.add '/mylinks.html'
end
from sitemap_generator.
Excellent, I'll try it and I'll close this. Might be nice if the sitemap_index.add found its way to the readme documentation...it was hard for me to navigate through the code to find that this does indeed exist.
Thank you for your hard work on this gem.
Kevin
from sitemap_generator.
When I try this:
SitemapGenerator.yield_sitemap = true
SitemapGenerator::Sitemap.create do |sitemap|
sitemap.sitemap_index.add '/blog/sitemap1.xml.gz'
end
I get:
rake aborted!
undefined method `sitemap_index' for #SitemapGenerator::Interpreter:0x5634b40
Any other thoughts?
from sitemap_generator.
Ok try this. It works for me:
SitemapGenerator::Sitemap.default_host = 'http://example.com'
SitemapGenerator::Sitemap.create do
@linkset.sitemap_index.add '/blog/sitemap1.xml.gz', :host => 'http://example.com'
end
You'll have to specify the :host on your link, but it gets the job done. In the next release I'll think about exposing the LinkSet instance through a method...maybe called 'sitemap'
from sitemap_generator.
You are the man. Works as advertised by referencing @linkset directly and adding the host.
BTW, I donated to the cause...wish I could do more but hoping others will put some in, too. I wouldn't be able to auto-generate a sitemap well without this gem of a gem. Thanks for the fix!
from sitemap_generator.
Ah yes, thanks for the donation! I noticed that. That is awesome man, thanks a lot.
from sitemap_generator.
Thank you for adding this:
v3.1.0: Add add_to_index method to add links to the sitemap index. Add sitemap method for accessing the LinkSet instance from within create(). Don't modify options hashes passed to methods. Fix and improve yield_sitemap option handling.
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.