Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Remove geo and cleanup builder #24

Merged
merged 2 commits into from

2 participants

@rngtng
Collaborator

Another small change: get rid of geobuilder (it never worked right & was tested anyway), make header config consistent using class constants.

Tobias Bielo... added some commits
@alexrabarts alexrabarts merged commit 69f13b9 into alexrabarts:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 14, 2011
  1. removed geo (never worked)

    Tobias Bielohlawek authored
  2. streamline Builder configs using constants

    Tobias Bielohlawek authored
This page is out of date. Refresh to see the latest.
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
@@ -378,9 +378,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
Something went wrong with that request. Please try again.