sitemap_generator_ftbpro 5.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +13 -0
  3. data/Gemfile.lock +35 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +1139 -0
  6. data/Rakefile +43 -0
  7. data/VERSION +1 -0
  8. data/lib/capistrano/sitemap_generator.rb +1 -0
  9. data/lib/capistrano/tasks/sitemap_generator.cap +36 -0
  10. data/lib/sitemap_generator/adapters/file_adapter.rb +43 -0
  11. data/lib/sitemap_generator/adapters/fog_adapter.rb +28 -0
  12. data/lib/sitemap_generator/adapters/s3_adapter.rb +41 -0
  13. data/lib/sitemap_generator/adapters/wave_adapter.rb +21 -0
  14. data/lib/sitemap_generator/adapters.rb +0 -0
  15. data/lib/sitemap_generator/application.rb +49 -0
  16. data/lib/sitemap_generator/builder/sitemap_file.rb +171 -0
  17. data/lib/sitemap_generator/builder/sitemap_index_file.rb +149 -0
  18. data/lib/sitemap_generator/builder/sitemap_index_url.rb +28 -0
  19. data/lib/sitemap_generator/builder/sitemap_url.rb +250 -0
  20. data/lib/sitemap_generator/builder.rb +8 -0
  21. data/lib/sitemap_generator/core_ext/big_decimal.rb +45 -0
  22. data/lib/sitemap_generator/core_ext/numeric.rb +48 -0
  23. data/lib/sitemap_generator/core_ext.rb +3 -0
  24. data/lib/sitemap_generator/helpers/number_helper.rb +237 -0
  25. data/lib/sitemap_generator/interpreter.rb +80 -0
  26. data/lib/sitemap_generator/link_set.rb +665 -0
  27. data/lib/sitemap_generator/railtie.rb +7 -0
  28. data/lib/sitemap_generator/sitemap_location.rb +192 -0
  29. data/lib/sitemap_generator/sitemap_namer.rb +75 -0
  30. data/lib/sitemap_generator/tasks.rb +53 -0
  31. data/lib/sitemap_generator/templates.rb +41 -0
  32. data/lib/sitemap_generator/utilities.rb +181 -0
  33. data/lib/sitemap_generator.rb +82 -0
  34. data/lib/tasks/sitemap_generator_tasks.rake +1 -0
  35. data/rails/install.rb +2 -0
  36. data/rails/uninstall.rb +2 -0
  37. data/spec/blueprint.rb +15 -0
  38. data/spec/files/sitemap.create.rb +12 -0
  39. data/spec/files/sitemap.groups.rb +49 -0
  40. data/spec/sitemap_generator/adapters/s3_adapter_spec.rb +23 -0
  41. data/spec/sitemap_generator/alternate_sitemap_spec.rb +79 -0
  42. data/spec/sitemap_generator/application_spec.rb +69 -0
  43. data/spec/sitemap_generator/builder/sitemap_file_spec.rb +110 -0
  44. data/spec/sitemap_generator/builder/sitemap_index_file_spec.rb +124 -0
  45. data/spec/sitemap_generator/builder/sitemap_index_url_spec.rb +28 -0
  46. data/spec/sitemap_generator/builder/sitemap_url_spec.rb +186 -0
  47. data/spec/sitemap_generator/core_ext/bigdecimal_spec.rb +20 -0
  48. data/spec/sitemap_generator/core_ext/numeric_spec.rb +43 -0
  49. data/spec/sitemap_generator/file_adaptor_spec.rb +20 -0
  50. data/spec/sitemap_generator/geo_sitemap_spec.rb +30 -0
  51. data/spec/sitemap_generator/helpers/number_helper_spec.rb +196 -0
  52. data/spec/sitemap_generator/interpreter_spec.rb +90 -0
  53. data/spec/sitemap_generator/link_set_spec.rb +864 -0
  54. data/spec/sitemap_generator/mobile_sitemap_spec.rb +27 -0
  55. data/spec/sitemap_generator/news_sitemap_spec.rb +42 -0
  56. data/spec/sitemap_generator/pagemap_sitemap_spec.rb +57 -0
  57. data/spec/sitemap_generator/sitemap_generator_spec.rb +582 -0
  58. data/spec/sitemap_generator/sitemap_groups_spec.rb +144 -0
  59. data/spec/sitemap_generator/sitemap_location_spec.rb +210 -0
  60. data/spec/sitemap_generator/sitemap_namer_spec.rb +96 -0
  61. data/spec/sitemap_generator/templates_spec.rb +24 -0
  62. data/spec/sitemap_generator/utilities/existence_spec.rb +26 -0
  63. data/spec/sitemap_generator/utilities/hash_spec.rb +57 -0
  64. data/spec/sitemap_generator/utilities/rounding_spec.rb +31 -0
  65. data/spec/sitemap_generator/utilities_spec.rb +101 -0
  66. data/spec/sitemap_generator/video_sitemap_spec.rb +117 -0
  67. data/spec/spec_helper.rb +24 -0
  68. data/spec/support/file_macros.rb +39 -0
  69. data/spec/support/schemas/siteindex.xsd +73 -0
  70. data/spec/support/schemas/sitemap-geo.xsd +41 -0
  71. data/spec/support/schemas/sitemap-mobile.xsd +32 -0
  72. data/spec/support/schemas/sitemap-news.xsd +159 -0
  73. data/spec/support/schemas/sitemap-pagemap.xsd +97 -0
  74. data/spec/support/schemas/sitemap-video.xsd +643 -0
  75. data/spec/support/schemas/sitemap.xsd +115 -0
  76. data/spec/support/xml_macros.rb +67 -0
  77. data/templates/sitemap.rb +27 -0
  78. metadata +226 -0
@@ -0,0 +1,101 @@
1
+ require 'spec_helper'
2
+
3
+ describe SitemapGenerator::Utilities do
4
+
5
+ describe "assert_valid_keys" do
6
+ it "should raise error on invalid keys" do
7
+ lambda {
8
+ SitemapGenerator::Utilities.assert_valid_keys({ :name => "Rob", :years => "28" }, :name, :age)
9
+ }.should raise_exception(ArgumentError)
10
+ lambda {
11
+ SitemapGenerator::Utilities.assert_valid_keys({ :name => "Rob", :age => "28" }, "name", "age")
12
+ }.should raise_exception(ArgumentError)
13
+ end
14
+
15
+ it "should not raise error on valid keys" do
16
+ lambda {
17
+ SitemapGenerator::Utilities.assert_valid_keys({ :name => "Rob", :age => "28" }, :name, :age)
18
+ }.should_not raise_exception
19
+
20
+ lambda {
21
+ SitemapGenerator::Utilities.assert_valid_keys({ :name => "Rob" }, :name, :age)
22
+ }.should_not raise_exception
23
+ end
24
+ end
25
+
26
+ describe "titleize" do
27
+ it "should titleize words and replace underscores" do
28
+ SitemapGenerator::Utilities.titleize('google').should == 'Google'
29
+ SitemapGenerator::Utilities.titleize('amy_and_jon').should == 'Amy And Jon'
30
+ end
31
+ end
32
+
33
+ describe "truthy?" do
34
+ it "should be truthy" do
35
+ ['1', 1, 't', 'true', true].each do |value|
36
+ SitemapGenerator::Utilities.truthy?(value).should be_true
37
+ end
38
+ SitemapGenerator::Utilities.truthy?(nil).should be_false
39
+ end
40
+ end
41
+
42
+ describe "falsy?" do
43
+ it "should be falsy" do
44
+ ['0', 0, 'f', 'false', false].each do |value|
45
+ SitemapGenerator::Utilities.falsy?(value).should be_true
46
+ end
47
+ SitemapGenerator::Utilities.falsy?(nil).should be_false
48
+ end
49
+ end
50
+
51
+ describe "as_array" do
52
+ it "should return an array unchanged" do
53
+ SitemapGenerator::Utilities.as_array([]).should == []
54
+ SitemapGenerator::Utilities.as_array([1]).should == [1]
55
+ SitemapGenerator::Utilities.as_array([1,2,3]).should == [1,2,3]
56
+ end
57
+
58
+ it "should return empty array on nil" do
59
+ SitemapGenerator::Utilities.as_array(nil).should == []
60
+ end
61
+
62
+ it "should make array of item otherwise" do
63
+ SitemapGenerator::Utilities.as_array('').should == ['']
64
+ SitemapGenerator::Utilities.as_array(1).should == [1]
65
+ SitemapGenerator::Utilities.as_array('hello').should == ['hello']
66
+ SitemapGenerator::Utilities.as_array({}).should == [{}]
67
+ end
68
+ end
69
+
70
+ describe "append_slash" do
71
+ SitemapGenerator::Utilities.append_slash('').should == ''
72
+ SitemapGenerator::Utilities.append_slash(nil).should == ''
73
+ SitemapGenerator::Utilities.append_slash(Pathname.new('')).should == ''
74
+ SitemapGenerator::Utilities.append_slash('tmp').should == 'tmp/'
75
+ SitemapGenerator::Utilities.append_slash(Pathname.new('tmp')).should == 'tmp/'
76
+ SitemapGenerator::Utilities.append_slash('tmp/').should == 'tmp/'
77
+ SitemapGenerator::Utilities.append_slash(Pathname.new('tmp/')).should == 'tmp/'
78
+ end
79
+
80
+ describe "ellipsis" do
81
+ it "should not modify when less than or equal to max" do
82
+ (1..10).each do |i|
83
+ string = 'a'*i
84
+ SitemapGenerator::Utilities.ellipsis(string, 10).should == string
85
+ end
86
+ end
87
+
88
+ it "should replace last 3 characters with ellipsis when greater than max" do
89
+ (1..5).each do |i|
90
+ string = 'aaaaa' + 'a'*i
91
+ SitemapGenerator::Utilities.ellipsis(string, 5).should == 'aa...'
92
+ end
93
+ end
94
+
95
+ it "should not freak out when string too small" do
96
+ SitemapGenerator::Utilities.ellipsis('a', 1).should == 'a'
97
+ SitemapGenerator::Utilities.ellipsis('aa', 1).should == '...'
98
+ SitemapGenerator::Utilities.ellipsis('aaa', 1).should == '...'
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,117 @@
1
+ require 'spec_helper'
2
+
3
+ describe "SitemapGenerator" do
4
+ let(:url_options) do
5
+ {
6
+ :host => 'http://example.com',
7
+ :path => 'cool_video.html'
8
+ }
9
+ end
10
+
11
+ let(:video_options) do
12
+ {
13
+ :thumbnail_loc => 'http://example.com/video1_thumbnail.png',
14
+ :title => 'Cool Video',
15
+ :content_loc => 'http://example.com/cool_video.mpg',
16
+ :player_loc => 'http://example.com/cool_video_player.swf',
17
+ :gallery_loc => 'http://example.com/cool_video_gallery',
18
+ :gallery_title => 'Gallery Title',
19
+ :allow_embed => true,
20
+ :autoplay => 'id=123',
21
+ :description => 'An new perspective in cool video technology',
22
+ :tags => %w(tag1 tag2 tag3),
23
+ :category => 'cat1',
24
+ :uploader => 'sokrates',
25
+ :uploader_info => 'http://sokrates.example.com',
26
+ :expiration_date => Time.at(0),
27
+ :publication_date => Time.at(0),
28
+ :family_friendly => true,
29
+ :view_count => 123,
30
+ :duration => 456,
31
+ :rating => 0.499999999,
32
+ :price => 123.45,
33
+ :price_currency => 'CAD',
34
+ :price_resolution => 'HD',
35
+ :price_type => 'rent'
36
+ }
37
+ end
38
+
39
+ # Return XML for the <URL> element.
40
+ def video_xml(video_options)
41
+ SitemapGenerator::Builder::SitemapUrl.new(url_options[:path], {
42
+ :host => url_options[:host],
43
+ :video => video_options
44
+ }).to_xml
45
+ end
46
+
47
+ # Return a Nokogiri document from the XML. The root of the document is the <URL> element.
48
+ def video_doc(xml)
49
+ Nokogiri::XML.parse("<root xmlns:video='#{SitemapGenerator::SCHEMAS['video']}'>#{xml}</root>")
50
+ end
51
+
52
+ # Validate the contents of the video element
53
+ def validate_video_element(video_doc, video_options)
54
+ video_doc.at_xpath('video:thumbnail_loc').text.should == video_options[:thumbnail_loc]
55
+ video_doc.at_xpath("video:thumbnail_loc").text.should == video_options[:thumbnail_loc]
56
+ video_doc.at_xpath("video:gallery_loc").text.should == video_options[:gallery_loc]
57
+ video_doc.at_xpath("video:gallery_loc").attribute('title').text.should == video_options[:gallery_title]
58
+ video_doc.at_xpath("video:title").text.should == video_options[:title]
59
+ video_doc.at_xpath("video:view_count").text.should == video_options[:view_count].to_s
60
+ video_doc.at_xpath("video:duration").text.should == video_options[:duration].to_s
61
+ video_doc.at_xpath("video:rating").text.should == ('%0.1f' % video_options[:rating])
62
+ video_doc.at_xpath("video:content_loc").text.should == video_options[:content_loc]
63
+ video_doc.at_xpath("video:category").text.should == video_options[:category]
64
+ video_doc.xpath("video:tag").collect(&:text).should == video_options[:tags]
65
+ video_doc.at_xpath("video:expiration_date").text.should == video_options[:expiration_date].iso8601
66
+ video_doc.at_xpath("video:publication_date").text.should == video_options[:publication_date].iso8601
67
+ video_doc.at_xpath("video:player_loc").text.should == video_options[:player_loc]
68
+ video_doc.at_xpath("video:player_loc").attribute('allow_embed').text.should == (video_options[:allow_embed] ? 'yes' : 'no')
69
+ video_doc.at_xpath("video:player_loc").attribute('autoplay').text.should == video_options[:autoplay]
70
+ video_doc.at_xpath("video:uploader").text.should == video_options[:uploader]
71
+ video_doc.at_xpath("video:uploader").attribute("info").text.should == video_options[:uploader_info]
72
+ video_doc.at_xpath("video:price").text.should == video_options[:price].to_s
73
+ video_doc.at_xpath("video:price").attribute("resolution").text.should == video_options[:price_resolution].to_s
74
+ video_doc.at_xpath("video:price").attribute("type").text.should == video_options[:price_type].to_s
75
+ video_doc.at_xpath("video:price").attribute("currency").text.should == video_options[:price_currency].to_s
76
+ xml_fragment_should_validate_against_schema(video_doc, 'sitemap-video', 'xmlns:video' => SitemapGenerator::SCHEMAS['video'])
77
+ end
78
+
79
+ it "should add a valid video sitemap element" do
80
+ xml = video_xml(video_options)
81
+ doc = video_doc(xml)
82
+ doc.at_xpath("//url/loc").text.should == File.join(url_options[:host], url_options[:path])
83
+ validate_video_element(doc.at_xpath('//url/video:video'), video_options)
84
+ end
85
+
86
+ it "should support multiple video elements" do
87
+ xml = video_xml([video_options, video_options])
88
+ doc = video_doc(xml)
89
+ doc.at_xpath("//url/loc").text.should == File.join(url_options[:host], url_options[:path])
90
+ doc.xpath('//url/video:video').count.should == 2
91
+ doc.xpath('//url/video:video').each do |video|
92
+ validate_video_element(video, video_options)
93
+ end
94
+ end
95
+
96
+ it "should default allow_embed to 'yes'" do
97
+ xml = video_xml(video_options.merge(:allow_embed => nil))
98
+ doc = video_doc(xml)
99
+ doc.at_xpath("//url/video:video/video:player_loc").attribute('allow_embed').text.should == 'yes'
100
+ end
101
+
102
+ it "should not include optional elements if they are not passed" do
103
+ optional = [:player_loc, :content_loc, :category, :tags, :tag, :uploader, :gallery_loc, :family_friendly, :publication_date, :expiration_date, :view_count, :rating, :duration]
104
+ required_options = video_options.delete_if { |k,v| optional.include?(k) }
105
+ xml = video_xml(required_options)
106
+ doc = video_doc(xml)
107
+ optional.each do |element|
108
+ doc.at_xpath("//url/video:video/video:#{element}").should be_nil
109
+ end
110
+ end
111
+
112
+ it "should not include autoplay param if blank" do
113
+ xml = video_xml(video_options.tap {|v| v.delete(:autoplay) })
114
+ doc = video_doc(xml)
115
+ doc.at_xpath("//url/video:video/video:player_loc").attribute('autoplay').should be_nil
116
+ end
117
+ end
@@ -0,0 +1,24 @@
1
+ # require 'simplecov'
2
+ # SimpleCov.start
3
+
4
+ require "bundler/setup"
5
+ Bundler.require
6
+ require 'rspec/autorun'
7
+
8
+ # Requires supporting files with custom matchers and macros, etc,
9
+ # in ./support/ and its subdirectories.
10
+ Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
11
+
12
+ SitemapGenerator.verbose = false
13
+
14
+ RSpec.configure do |config|
15
+ config.mock_with :mocha
16
+ config.include(FileMacros)
17
+ config.include(XmlMacros)
18
+
19
+ # Pass :focus option to +describe+ or +it+ to run that spec only
20
+ config.treat_symbols_as_metadata_keys_with_true_values = true
21
+ config.filter_run :focus => true
22
+ config.run_all_when_everything_filtered = true
23
+ config.filter_run_excluding :integration => true
24
+ end
@@ -0,0 +1,39 @@
1
+ module FileMacros
2
+ module ExampleMethods
3
+
4
+ def files_should_be_identical(first, second)
5
+ identical_files?(first, second).should be(true)
6
+ end
7
+
8
+ def files_should_not_be_identical(first, second)
9
+ identical_files?(first, second).should be(false)
10
+ end
11
+
12
+ def file_should_exist(file)
13
+ File.exists?(file).should be(true), "File #{file} should exist"
14
+ end
15
+
16
+ def directory_should_exist(dir)
17
+ File.exists?(dir).should be(true), "Directory #{dir} should exist"
18
+ File.directory?(dir).should be(true), "#{dir} should be a directory"
19
+ end
20
+
21
+ def directory_should_not_exist(dir)
22
+ File.exists?(dir).should be(false), "Directory #{dir} should not exist"
23
+ end
24
+
25
+ def file_should_not_exist(file)
26
+ File.exists?(file).should be(false), "File #{file} should not exist"
27
+ end
28
+
29
+ def identical_files?(first, second)
30
+ file_should_exist(first)
31
+ file_should_exist(second)
32
+ open(second, 'r').read.should == open(first, 'r').read
33
+ end
34
+ end
35
+
36
+ def self.included(receiver)
37
+ receiver.send :include, ExampleMethods
38
+ end
39
+ end
@@ -0,0 +1,73 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
3
+ targetNamespace="http://www.sitemaps.org/schemas/sitemap/0.9"
4
+ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
5
+ elementFormDefault="qualified">
6
+ <xsd:annotation>
7
+ <xsd:documentation>
8
+ XML Schema for Sitemap index files.
9
+ Last Modifed 2009-04-08
10
+ </xsd:documentation>
11
+ </xsd:annotation>
12
+
13
+ <xsd:element name="sitemapindex">
14
+ <xsd:annotation>
15
+ <xsd:documentation>
16
+ Container for a set of up to 50,000 sitemap URLs.
17
+ This is the root element of the XML file.
18
+ </xsd:documentation>
19
+ </xsd:annotation>
20
+ <xsd:complexType>
21
+ <xsd:sequence>
22
+ <xsd:element name="sitemap" type="tSitemap" maxOccurs="unbounded"/>
23
+ </xsd:sequence>
24
+ </xsd:complexType>
25
+ </xsd:element>
26
+
27
+ <xsd:complexType name="tSitemap">
28
+ <xsd:annotation>
29
+ <xsd:documentation>
30
+ Container for the data needed to describe a sitemap.
31
+ </xsd:documentation>
32
+ </xsd:annotation>
33
+ <xsd:all>
34
+ <xsd:element name="loc" type="tLocSitemap"/>
35
+ <xsd:element name="lastmod" type="tLastmodSitemap" minOccurs="0"/>
36
+ </xsd:all>
37
+ </xsd:complexType>
38
+
39
+ <xsd:simpleType name="tLocSitemap">
40
+ <xsd:annotation>
41
+ <xsd:documentation>
42
+ REQUIRED: The location URI of a sitemap.
43
+ The URI must conform to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt).
44
+ </xsd:documentation>
45
+ </xsd:annotation>
46
+ <xsd:restriction base="xsd:anyURI">
47
+ <xsd:minLength value="12"/>
48
+ <xsd:maxLength value="2048"/>
49
+ </xsd:restriction>
50
+ </xsd:simpleType>
51
+
52
+ <xsd:simpleType name="tLastmodSitemap">
53
+ <xsd:annotation>
54
+ <xsd:documentation>
55
+ OPTIONAL: The date the document was last modified. The date must conform
56
+ to the W3C DATETIME format (http://www.w3.org/TR/NOTE-datetime).
57
+ Example: 2005-05-10
58
+ Lastmod may also contain a timestamp.
59
+ Example: 2005-05-10T17:33:30+08:00
60
+ </xsd:documentation>
61
+ </xsd:annotation>
62
+ <xsd:union>
63
+ <xsd:simpleType>
64
+ <xsd:restriction base="xsd:date"/>
65
+ </xsd:simpleType>
66
+ <xsd:simpleType>
67
+ <xsd:restriction base="xsd:dateTime"/>
68
+ </xsd:simpleType>
69
+ </xsd:union>
70
+ </xsd:simpleType>
71
+
72
+
73
+ </xsd:schema>
@@ -0,0 +1,41 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <xsd:schema
3
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4
+ targetNamespace="http://www.google.com/geo/schemas/sitemap/1.0"
5
+ xmlns="http://www.google.com/geo/schemas/sitemap/1.0"
6
+ elementFormDefault="qualified">
7
+
8
+ <xsd:annotation>
9
+ <xsd:documentation>
10
+ XML Schema for the Geo Sitemap extension. This schema defines the
11
+ Geo-specific elements only; the core Sitemap elements are defined
12
+ separately.
13
+
14
+ Help Center documentation for the Geo Sitemap extension:
15
+
16
+ http://www.google.com/support/webmasters/bin/topic.py?topic=14688
17
+
18
+ Copyright 2010 Google Inc. All Rights Reserved.
19
+ </xsd:documentation>
20
+ </xsd:annotation>
21
+
22
+ <xsd:element name="geo">
23
+ <xsd:complexType>
24
+ <xsd:sequence>
25
+ <xsd:element name="format">
26
+ <xsd:annotation>
27
+ <xsd:documentation>
28
+ Specifies the format of the geo content.
29
+ </xsd:documentation>
30
+ </xsd:annotation>
31
+ <xsd:simpleType>
32
+ <xsd:restriction base="xsd:string">
33
+ <xsd:pattern value="[kK][mM][lL]|[kK][mM][zZ]|[gG][eE][oO][rR][sS][sS]"/>
34
+ </xsd:restriction>
35
+ </xsd:simpleType>
36
+ </xsd:element>
37
+ </xsd:sequence>
38
+ </xsd:complexType>
39
+ </xsd:element>
40
+
41
+ </xsd:schema>
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <xsd:schema
3
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4
+ targetNamespace="http://www.google.com/schemas/sitemap-mobile/1.0"
5
+ xmlns="http://www.google.com/schemas/sitemap-mobile/1.0"
6
+ elementFormDefault="qualified">
7
+
8
+ <xsd:annotation>
9
+ <xsd:documentation>
10
+ XML Schema for the Mobile Sitemap extension. This schema defines the
11
+ Mobile-specific elements only; the core Sitemap elements are defined
12
+ separately.
13
+
14
+ Help Center documentation for the Mobile Sitemap extension:
15
+
16
+ http://www.google.com/support/webmasters/bin/topic.py?topic=8493
17
+
18
+ Copyright 2010 Google Inc. All Rights Reserved.
19
+ </xsd:documentation>
20
+ </xsd:annotation>
21
+
22
+ <xsd:element name="mobile">
23
+ <xsd:annotation>
24
+ <xsd:documentation>
25
+ Mobile sitemaps just contain an empty "mobile" tag to identify a
26
+ URL as having mobile content.
27
+ </xsd:documentation>
28
+ </xsd:annotation>
29
+ <xsd:complexType/>
30
+ </xsd:element>
31
+
32
+ </xsd:schema>
@@ -0,0 +1,159 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsd:schema
3
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4
+ targetNamespace="http://www.google.com/schemas/sitemap-news/0.9"
5
+ xmlns="http://www.google.com/schemas/sitemap-news/0.9"
6
+ elementFormDefault="qualified">
7
+
8
+ <xsd:annotation>
9
+ <xsd:documentation>
10
+ XML Schema for the News Sitemap extension. This schema defines the
11
+ News-specific elements only; the core Sitemap elements are defined
12
+ separately.
13
+
14
+ Help Center documentation for the News Sitemap extension:
15
+
16
+ http://www.google.com/support/news_pub/bin/topic.py?topic=11666
17
+
18
+ Copyright 2010 Google Inc. All Rights Reserved.
19
+ </xsd:documentation>
20
+ </xsd:annotation>
21
+
22
+ <xsd:element name="news">
23
+ <xsd:complexType>
24
+ <xsd:sequence>
25
+ <xsd:element name="publication">
26
+ <xsd:annotation>
27
+ <xsd:documentation>
28
+ The publication in which the article appears. Required.
29
+ </xsd:documentation>
30
+ </xsd:annotation>
31
+ <xsd:complexType>
32
+ <xsd:sequence>
33
+ <xsd:element name="name" type="xsd:string">
34
+ <xsd:annotation>
35
+ <xsd:documentation>
36
+ Name of the news publication. It must exactly match
37
+ the name as it appears on your articles in news.google.com,
38
+ omitting any trailing parentheticals.
39
+ For example, if the name appears in Google News as
40
+ "The Example Times (subscription)", you should use
41
+ "The Example Times". Required.
42
+ </xsd:documentation>
43
+ </xsd:annotation>
44
+ </xsd:element>
45
+ <xsd:element name="language">
46
+ <xsd:annotation>
47
+ <xsd:documentation>
48
+ Language of the publication. It should be an
49
+ ISO 639 Language Code (either 2 or 3 letters); see:
50
+ http://www.loc.gov/standards/iso639-2/php/code_list.php
51
+ Exception: For Chinese, please use zh-cn for Simplified
52
+ Chinese or zh-tw for Traditional Chinese. Required.
53
+ </xsd:documentation>
54
+ </xsd:annotation>
55
+ <xsd:simpleType>
56
+ <xsd:restriction base="xsd:string">
57
+ <xsd:pattern value="zh-cn|zh-tw|([a-z]{2,3})"/>
58
+ </xsd:restriction>
59
+ </xsd:simpleType>
60
+ </xsd:element>
61
+ </xsd:sequence>
62
+ </xsd:complexType>
63
+ </xsd:element>
64
+ <xsd:element name="access" minOccurs="0">
65
+ <xsd:annotation>
66
+ <xsd:documentation>
67
+ Accessibility of the article. Required if access is not open,
68
+ otherwise this tag should be omitted.
69
+ </xsd:documentation>
70
+ </xsd:annotation>
71
+ <xsd:simpleType>
72
+ <xsd:restriction base="xsd:string">
73
+ <xsd:enumeration value="Subscription"/>
74
+ <xsd:enumeration value="Registration"/>
75
+ </xsd:restriction>
76
+ </xsd:simpleType>
77
+ </xsd:element>
78
+ <xsd:element name="genres" minOccurs="0">
79
+ <xsd:annotation>
80
+ <xsd:documentation>
81
+ A comma-separated list of properties characterizing the content
82
+ of the article, such as "PressRelease" or "UserGenerated".
83
+ For a list of possible values, see:
84
+ http://www.google.com/support/news_pub/bin/answer.py?answer=93992
85
+ Required if any genres apply to the article, otherwise this tag
86
+ should be omitted.
87
+ </xsd:documentation>
88
+ </xsd:annotation>
89
+ <xsd:simpleType>
90
+ <xsd:restriction base="xsd:string">
91
+ <xsd:pattern value="(PressRelease|Satire|Blog|OpEd|Opinion|UserGenerated)(, *(PressRelease|Satire|Blog|OpEd|Opinion|UserGenerated))*"/>
92
+ </xsd:restriction>
93
+ </xsd:simpleType>
94
+ </xsd:element>
95
+ <xsd:element name="publication_date">
96
+ <xsd:annotation>
97
+ <xsd:documentation>
98
+ Article publication date in W3C format, specifying the complete
99
+ date (YYYY-MM-DD) with optional timestamp. See:
100
+ http://www.w3.org/TR/NOTE-datetime
101
+ Please ensure that you give the original date and time at which
102
+ the article was published on your site; do not give the time
103
+ at which the article was added to your Sitemap. Required.
104
+ </xsd:documentation>
105
+ </xsd:annotation>
106
+ <xsd:simpleType>
107
+ <xsd:union>
108
+ <xsd:simpleType>
109
+ <xsd:restriction base="xsd:date"/>
110
+ </xsd:simpleType>
111
+ <xsd:simpleType>
112
+ <xsd:restriction base="xsd:dateTime"/>
113
+ </xsd:simpleType>
114
+ </xsd:union>
115
+ </xsd:simpleType>
116
+ </xsd:element>
117
+ <xsd:element name="title" type="xsd:string" minOccurs="0">
118
+ <xsd:annotation>
119
+ <xsd:documentation>
120
+ Title of the news article. Optional, but highly recommended.
121
+ Note: The title may be truncated for space reasons when shown
122
+ on Google News.
123
+ </xsd:documentation>
124
+ </xsd:annotation>
125
+ </xsd:element>
126
+ <xsd:element name="keywords" type="xsd:string" minOccurs="0">
127
+ <xsd:annotation>
128
+ <xsd:documentation>
129
+ Comma-separated list of keywords describing the topic of
130
+ the article. Keywords may be drawn from, but are not limited to,
131
+ the list of existing Google News keywords; see:
132
+ http://www.google.com/support/news_pub/bin/answer.py?answer=116037
133
+ Optional.
134
+ </xsd:documentation>
135
+ </xsd:annotation>
136
+ </xsd:element>
137
+ <xsd:element name="stock_tickers" minOccurs="0">
138
+ <xsd:annotation>
139
+ <xsd:documentation>
140
+ Comma-separated list of up to 5 stock tickers of the companies,
141
+ mutual funds, or other financial entities that are the main subject
142
+ of the article. Relevant primarily for business articles.
143
+ Each ticker must be prefixed by the name of its stock exchange,
144
+ and must match its entry in Google Finance.
145
+ For example, "NASDAQ:AMAT" (but not "NASD:AMAT"),
146
+ or "BOM:500325" (but not "BOM:RIL"). Optional.
147
+ </xsd:documentation>
148
+ </xsd:annotation>
149
+ <xsd:simpleType>
150
+ <xsd:restriction base="xsd:string">
151
+ <xsd:pattern value="(\w+:\w+(, *\w+:\w+){0,4})?"/>
152
+ </xsd:restriction>
153
+ </xsd:simpleType>
154
+ </xsd:element>
155
+ </xsd:sequence>
156
+ </xsd:complexType>
157
+ </xsd:element>
158
+
159
+ </xsd:schema>