Created
December 19, 2012 22:39
-
-
Save anonymous/4341222 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rewrite ^/sitemap1.xml.gz /sitemaps/$host/sitemap1.xml.gz last; | |
rewrite ^/sitemap_index.xml.gz /sitemaps/$host/sitemap_index.xml.gz last; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sitemap_generator' | |
Constants::HOSTS.each do |host, locale| | |
SitemapGenerator::Sitemap.default_host = "http://#{host}" | |
SitemapGenerator::Sitemap.public_path = "public/sitemaps/#{host}" | |
SitemapGenerator::Sitemap.sitemaps_path = '' | |
SitemapGenerator::Sitemap.create do | |
add root_path, priority: 1 | |
Property.find_each do |property| | |
add property_path(property), | |
priority: 0.8, | |
lastmod: (property.updated_at || property.created_at), | |
alternates: Constants::HOSTS.map { |h, l| | |
if locale != l | |
{ | |
href: property_url(property, host: h), | |
lang: l | |
} | |
end | |
}.compact | |
end | |
end | |
SitemapGenerator::Sitemap.ping_search_engines | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment