Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #24 from rngtng/remove-geo-cleanup-builder

Remove geo and cleanup builder
  • Loading branch information...
commit 69f13b99b2524079c916a5d445bab6baad09ddb8 2 parents ca8b929 + 2245394
@alexrabarts authored
Showing with 8 additions and 19 deletions.
  1. +0 −3  lib/big_sitemap.rb
  2. +8 −16 lib/big_sitemap/builder.rb
View
3  lib/big_sitemap.rb
@@ -381,9 +381,6 @@ def with_sitemap(options={})
sitemap = if options[:type] == 'index'
IndexBuilder.new(options)
- elsif options[:geo]
- options[:filename] << '_kml'
- GeoBuilder.new(options)
else
Builder.new(options)
end
View
24 lib/big_sitemap/builder.rb
@@ -4,10 +4,11 @@
class BigSitemap
class Builder
MAX_URLS = 50000
+ HEADER_NAME = 'urlset'
HEADER_ATTRIBUTES = {
'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9',
'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/sitemap.xsd"
+ 'xsi:schemaLocation' => "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
}
def initialize(options)
@@ -75,11 +76,11 @@ def _open_writer(filename)
@gzip ? ::Zlib::GzipWriter.new(file) : file
end
- def _init_document(name='urlset', attrs=HEADER_ATTRIBUTES)
+ def _init_document
@urls = 0
target!.print '<?xml version="1.0" encoding="UTF-8"?>'
_newline
- _open_tag name, attrs
+ _open_tag self.class::HEADER_NAME, self.class::HEADER_ATTRIBUTES
end
def _rotate(part_nr=nil)
@@ -141,10 +142,10 @@ def _newline
end
class IndexBuilder < Builder
- def _init_document(name = 'sitemapindex', attrs = {'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9'})
- attrs.merge('xmlns:geo' => "http://www.google.com/geo/schemas/sitemap/1.0")
- super(name, attrs)
- end
+ HEADER_NAME = 'sitemapindex'
+ HEADER_ATTRIBUTES = {
+ 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9'
+ }
def add_url!(location, options={})
_open_tag 'sitemap'
@@ -156,14 +157,5 @@ def add_url!(location, options={})
end
end
- class GeoBuilder < Builder
- #_build_geo if @geo
-
- # def _build_geo
- # geo :geo do
- # geo :format, 'kml'
- # end
- # end
- end
end
Please sign in to comment.
Something went wrong with that request. Please try again.