Comments (7)
Hi chamnap,
You are in luck! If you had asked a little while ago, it would have been very difficult, but recent changes I've made make it very easy.
I'm still working on the API, so this consider this experimental stuff. Put this in your config/sitemap.rb and refresh your sitemaps. You'll get an exception at the end, but the sitemaps should be created ok.
Alternatively you can add require 'sitemap_generator'
to the script and run it with ./script/runner config/sitemap.rb and you won't get an exception, but you also won't see the stats output.
SitemapGenerator::Sitemap.yahoo_app_id = false
SitemapGenerator::Sitemap.sitemaps_path = "en/"
SitemapGenerator::Sitemap.default_host = "http://www.en.example.com"
SitemapGenerator::Sitemap.create do
add '/english-site'
end
SitemapGenerator::Sitemap.sitemaps_path = "fr/"
SitemapGenerator::Sitemap.default_host = "http://www.fr.example.com"
SitemapGenerator::Sitemap.create do
add '/french-site'
end
SitemapGenerator::Sitemap.sitemaps_path = "ru/"
SitemapGenerator::Sitemap.default_host = "http://www.ru.example.com"
SitemapGenerator::Sitemap.create do
add '/russian-site'
end
from sitemap_generator.
Alright, thanks for reply. I figured out by go through the code base, but a slicely different approach.
from sitemap_generator.
Closing
from sitemap_generator.
It seems it doesn't work in a loop. The first domain is generated correctly in sitemap file, but the rest doesn't (only example.com).
from sitemap_generator.
What do you mean "it doesn't work in a loop"? You'll have to paste your code for me to understand what you mean. The example I gave works fine, as does this:
SitemapGenerator::Sitemap.yahoo_app_id = false
%w[en fr ru].each do |domain|
SitemapGenerator::Sitemap.sitemaps_path = "#{domain}/"
SitemapGenerator::Sitemap.default_host = "http://www.#{domain}.example.com"
SitemapGenerator::Sitemap.create do
add '/whatever'
end
end
from sitemap_generator.
Well, the above code works fine, except in the sitemap file of the second and third domain name, the generated domain name is http://example.com/.
from sitemap_generator.
Hmm, yeah the host in the sitemap file e.g. sitemap1.xml is correct, but the host in the index file is not.
I'll take a look when I get a chance.
from sitemap_generator.
Related Issues (20)
- 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
- Remove deprecated Google ping 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.