middleman-search_engine_sitemap 1.0.0.rc
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +59 -0
- data/Rakefile +7 -0
- data/lib/middleman-search_engine_sitemap.rb +2 -0
- data/lib/middleman/search_engine_sitemap.rb +59 -0
- data/lib/middleman/search_engine_sitemap/templates/sitemap.xml.builder +11 -0
- data/lib/middleman/search_engine_sitemap/version.rb +5 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-search_engine_sitemap.gemspec +28 -0
- data/sitemap.xsd +116 -0
- data/spec/dummy/source/about.html +3 -0
- data/spec/dummy/source/blog.html +3 -0
- data/spec/dummy/source/home.html +0 -0
- data/spec/dummy/source/layouts/layout.erb +1 -0
- data/spec/features/sitemap_feature_spec.rb +38 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/support/middleman_server_helpers.rb +42 -0
- data/spec/support/xml_helpers.rb +51 -0
- metadata +158 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b7129a08b5e62d5c403c2f259a09a412f78505e1
|
4
|
+
data.tar.gz: 92665355ff2df8644df9a824931963eadb5defd2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 101d3144f9547fd7eda5568f7456d7982328b30bcffd3f9ee5bd6e274de64b4a14e0e913fd4398f9708b9fc6ba7925e441c43b7589bdf474832f482ed27ff7cc
|
7
|
+
data.tar.gz: 82922fcf9f4361b6b9e753971cff429994cfd0c4c7fbeed18b2833b5b3627ab68de08f5f2ae24478e11246027e0e59fbc9f96c4c84d9554178f82a0c1f0cee90
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Pete Nicholls
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Middleman Search Engine Sitemap
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/Aupajo/middleman-search_engine_sitemap.png?branch=master)](https://travis-ci.org/Aupajo/middleman-search_engine_sitemap)
|
4
|
+
|
5
|
+
Adds a sitemap.xml file (following the sitemaps.org protocol) to your Middleman site for major search engines including Google.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
TODO: Write installation instructions
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Inside your `config.rb`:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
set :url_root, 'http://example.com'
|
17
|
+
|
18
|
+
activate :search_engine_sitemap
|
19
|
+
```
|
20
|
+
|
21
|
+
Pages have a priority of 0.5 and a change frequency of "monthly" by default.
|
22
|
+
|
23
|
+
You can change this by passing in options:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
activate :search_engine_sitemap, default_priority: 0.5,
|
27
|
+
default_change_frequency: "monthly",
|
28
|
+
sitemap_xml_path: "sitemap.xml"
|
29
|
+
```
|
30
|
+
|
31
|
+
You can override the priority or change frequency on page by using frontmatter:
|
32
|
+
|
33
|
+
```erb
|
34
|
+
---
|
35
|
+
title: Blog
|
36
|
+
priority: 1.0
|
37
|
+
change_frequency: daily
|
38
|
+
---
|
39
|
+
|
40
|
+
Welcome to my blog!
|
41
|
+
```
|
42
|
+
|
43
|
+
### On priority
|
44
|
+
|
45
|
+
From [sitemaps.org](http://www.sitemaps.org/protocol.html):
|
46
|
+
|
47
|
+
> Valid values range from 0.0 to 1.0. **This value does not affect how your pages are compared to pages on other sites**–it only lets the search engines know which pages you deem most important for the crawlers.
|
48
|
+
|
49
|
+
> Please note that the priority you assign to a page is not likely to influence the position of your URLs in a search engine's result pages. Search engines may use this information when selecting between URLs on the same site, so you can use this tag to increase the likelihood that your most important pages are present in a search index.
|
50
|
+
|
51
|
+
> Also, please note that assigning a high priority to all of the URLs on your site is not likely to help you. Since the priority is relative, it is only used to select between URLs on your site.
|
52
|
+
|
53
|
+
## Contributing
|
54
|
+
|
55
|
+
1. Fork it ( http://github.com/<my-github-username>/middleman-search_engine_sitemap/fork )
|
56
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
57
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
58
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
59
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require "middleman-core"
|
2
|
+
require "middleman/search_engine_sitemap/version"
|
3
|
+
require "builder"
|
4
|
+
|
5
|
+
module Middleman
|
6
|
+
module SearchEngineSitemap
|
7
|
+
TEMPLATES_DIR = File.expand_path(File.join('..', 'search_engine_sitemap', 'templates'), __FILE__)
|
8
|
+
|
9
|
+
class Extension < Middleman::Extension
|
10
|
+
option :default_priority, 0.5, 'Default page priority for search engine sitemap'
|
11
|
+
option :default_change_frequency, 'monthly', 'Default page priority for search engine sitemap'
|
12
|
+
option :sitemap_xml_path, 'sitemap.xml', 'Path to search engine sitemap'
|
13
|
+
|
14
|
+
def before_configuration
|
15
|
+
register_extension_templates
|
16
|
+
end
|
17
|
+
|
18
|
+
def manipulate_resource_list(resources)
|
19
|
+
resources << sitemap_resource
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def register_extension_templates
|
25
|
+
# We call reload_path to register the templates directory with Middleman.
|
26
|
+
# The path given to app.files must be relative to the Middleman site's root.
|
27
|
+
templates_dir_relative_from_root = Pathname(TEMPLATES_DIR).relative_path_from(Pathname(app.root))
|
28
|
+
app.files.reload_path(templates_dir_relative_from_root)
|
29
|
+
end
|
30
|
+
|
31
|
+
def sitemap_resource
|
32
|
+
source_file = template('sitemap.xml.builder')
|
33
|
+
|
34
|
+
Middleman::Sitemap::Resource.new(app.sitemap, sitemap_xml_path, source_file).tap do |resource|
|
35
|
+
resource.add_metadata(options: { layout: false }, locals: sitemap_locals)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def sitemap_locals
|
40
|
+
{
|
41
|
+
default_priority: options.default_priority,
|
42
|
+
default_change_frequency: options.default_change_frequency
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def template(path)
|
47
|
+
full_path = File.join(TEMPLATES_DIR, path)
|
48
|
+
raise "Template #{full_path} not found" if !File.exist?(full_path)
|
49
|
+
full_path
|
50
|
+
end
|
51
|
+
|
52
|
+
def sitemap_xml_path
|
53
|
+
options.sitemap_xml_path
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
::Middleman::Extensions.register(:search_engine_sitemap, ::Middleman::SearchEngineSitemap::Extension)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
xml.instruct!
|
2
|
+
xml.urlset 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9' do
|
3
|
+
sitemap.resources.select { |page| page.path =~ /\.html/ }.each do |page|
|
4
|
+
xml.url do
|
5
|
+
xml.loc File.join(url_root, page.path)
|
6
|
+
xml.lastmod File.mtime(page.source_file).iso8601
|
7
|
+
xml.changefreq page.data.change_frequency || default_change_frequency
|
8
|
+
xml.priority page.data.priority || default_priority
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# Auto-register extension for Middleman
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'middleman/search_engine_sitemap/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "middleman-search_engine_sitemap"
|
8
|
+
spec.version = Middleman::SearchEngineSitemap::VERSION
|
9
|
+
spec.authors = ["Pete Nicholls"]
|
10
|
+
spec.email = ["pete@metanation.com"]
|
11
|
+
spec.summary = %q{Adds a sitemap.xml file to your Middleman site for search engines.}
|
12
|
+
spec.description = %q{Adds a sitemap.xml file (following the sitemaps.org protocol) to your Middleman site for major search engines including Google.}
|
13
|
+
spec.homepage = "https://github.com/Aupajo/middleman-search_engine_sitemap"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "middleman-core", "~> 3.2.0"
|
22
|
+
spec.add_runtime_dependency "builder"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rspec"
|
27
|
+
spec.add_development_dependency "nokogiri"
|
28
|
+
end
|
data/sitemap.xsd
ADDED
@@ -0,0 +1,116 @@
|
|
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 files.
|
9
|
+
Last Modifed 2008-03-26
|
10
|
+
</xsd:documentation>
|
11
|
+
</xsd:annotation>
|
12
|
+
|
13
|
+
<xsd:element name="urlset">
|
14
|
+
<xsd:annotation>
|
15
|
+
<xsd:documentation>
|
16
|
+
Container for a set of up to 50,000 document elements.
|
17
|
+
This is the root element of the XML file.
|
18
|
+
</xsd:documentation>
|
19
|
+
</xsd:annotation>
|
20
|
+
<xsd:complexType>
|
21
|
+
<xsd:sequence>
|
22
|
+
<xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="strict"/>
|
23
|
+
<xsd:element name="url" type="tUrl" maxOccurs="unbounded"/>
|
24
|
+
</xsd:sequence>
|
25
|
+
</xsd:complexType>
|
26
|
+
</xsd:element>
|
27
|
+
|
28
|
+
<xsd:complexType name="tUrl">
|
29
|
+
<xsd:annotation>
|
30
|
+
<xsd:documentation>
|
31
|
+
Container for the data needed to describe a document to crawl.
|
32
|
+
</xsd:documentation>
|
33
|
+
</xsd:annotation>
|
34
|
+
<xsd:sequence>
|
35
|
+
<xsd:element name="loc" type="tLoc"/>
|
36
|
+
<xsd:element name="lastmod" type="tLastmod" minOccurs="0"/>
|
37
|
+
<xsd:element name="changefreq" type="tChangeFreq" minOccurs="0"/>
|
38
|
+
<xsd:element name="priority" type="tPriority" minOccurs="0"/>
|
39
|
+
<xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="strict"/>
|
40
|
+
</xsd:sequence>
|
41
|
+
</xsd:complexType>
|
42
|
+
|
43
|
+
<xsd:simpleType name="tLoc">
|
44
|
+
<xsd:annotation>
|
45
|
+
<xsd:documentation>
|
46
|
+
REQUIRED: The location URI of a document.
|
47
|
+
The URI must conform to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt).
|
48
|
+
</xsd:documentation>
|
49
|
+
</xsd:annotation>
|
50
|
+
<xsd:restriction base="xsd:anyURI">
|
51
|
+
<xsd:minLength value="12"/>
|
52
|
+
<xsd:maxLength value="2048"/>
|
53
|
+
</xsd:restriction>
|
54
|
+
</xsd:simpleType>
|
55
|
+
|
56
|
+
<xsd:simpleType name="tLastmod">
|
57
|
+
<xsd:annotation>
|
58
|
+
<xsd:documentation>
|
59
|
+
OPTIONAL: The date the document was last modified. The date must conform
|
60
|
+
to the W3C DATETIME format (http://www.w3.org/TR/NOTE-datetime).
|
61
|
+
Example: 2005-05-10
|
62
|
+
Lastmod may also contain a timestamp.
|
63
|
+
Example: 2005-05-10T17:33:30+08:00
|
64
|
+
</xsd:documentation>
|
65
|
+
</xsd:annotation>
|
66
|
+
<xsd:union>
|
67
|
+
<xsd:simpleType>
|
68
|
+
<xsd:restriction base="xsd:date"/>
|
69
|
+
</xsd:simpleType>
|
70
|
+
<xsd:simpleType>
|
71
|
+
<xsd:restriction base="xsd:dateTime"/>
|
72
|
+
</xsd:simpleType>
|
73
|
+
</xsd:union>
|
74
|
+
</xsd:simpleType>
|
75
|
+
|
76
|
+
<xsd:simpleType name="tChangeFreq">
|
77
|
+
<xsd:annotation>
|
78
|
+
<xsd:documentation>
|
79
|
+
OPTIONAL: Indicates how frequently the content at a particular URL is
|
80
|
+
likely to change. The value "always" should be used to describe
|
81
|
+
documents that change each time they are accessed. The value "never"
|
82
|
+
should be used to describe archived URLs. Please note that web
|
83
|
+
crawlers may not necessarily crawl pages marked "always" more often.
|
84
|
+
Consider this element as a friendly suggestion and not a command.
|
85
|
+
</xsd:documentation>
|
86
|
+
</xsd:annotation>
|
87
|
+
<xsd:restriction base="xsd:string">
|
88
|
+
<xsd:enumeration value="always"/>
|
89
|
+
<xsd:enumeration value="hourly"/>
|
90
|
+
<xsd:enumeration value="daily"/>
|
91
|
+
<xsd:enumeration value="weekly"/>
|
92
|
+
<xsd:enumeration value="monthly"/>
|
93
|
+
<xsd:enumeration value="yearly"/>
|
94
|
+
<xsd:enumeration value="never"/>
|
95
|
+
</xsd:restriction>
|
96
|
+
</xsd:simpleType>
|
97
|
+
|
98
|
+
<xsd:simpleType name="tPriority">
|
99
|
+
<xsd:annotation>
|
100
|
+
<xsd:documentation>
|
101
|
+
OPTIONAL: The priority of a particular URL relative to other pages
|
102
|
+
on the same site. The value for this element is a number between
|
103
|
+
0.0 and 1.0 where 0.0 identifies the lowest priority page(s).
|
104
|
+
The default priority of a page is 0.5. Priority is used to select
|
105
|
+
between pages on your site. Setting a priority of 1.0 for all URLs
|
106
|
+
will not help you, as the relative priority of pages on your site
|
107
|
+
is what will be considered.
|
108
|
+
</xsd:documentation>
|
109
|
+
</xsd:annotation>
|
110
|
+
<xsd:restriction base="xsd:decimal">
|
111
|
+
<xsd:minInclusive value="0.0"/>
|
112
|
+
<xsd:maxInclusive value="1.0"/>
|
113
|
+
</xsd:restriction>
|
114
|
+
</xsd:simpleType>
|
115
|
+
|
116
|
+
</xsd:schema>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
Layout
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
describe "Search engine sitemaps", :feature do
|
5
|
+
include XmlHelpers
|
6
|
+
|
7
|
+
it "produces a sitemap" do
|
8
|
+
run_site 'dummy' do
|
9
|
+
set :url_root, 'http://example.com'
|
10
|
+
|
11
|
+
activate :search_engine_sitemap
|
12
|
+
end
|
13
|
+
|
14
|
+
visit '/sitemap.xml'
|
15
|
+
|
16
|
+
schema = File.expand_path('../../../sitemap.xsd', __FILE__)
|
17
|
+
doc = Nokogiri::XML(last_response.body)
|
18
|
+
expect(doc).to validate_against_schema(schema)
|
19
|
+
|
20
|
+
expect(doc).to contain_node('url').with_children(
|
21
|
+
'loc' => 'http://example.com/home.html',
|
22
|
+
'priority' => '0.5',
|
23
|
+
'changefreq' => 'monthly'
|
24
|
+
)
|
25
|
+
|
26
|
+
expect(doc).to contain_node('url').with_children(
|
27
|
+
'loc' => 'http://example.com/about.html',
|
28
|
+
'priority' => '0.2',
|
29
|
+
'changefreq' => 'monthly'
|
30
|
+
)
|
31
|
+
|
32
|
+
expect(doc).to contain_node('url').with_children(
|
33
|
+
'loc' => 'http://example.com/blog.html',
|
34
|
+
'priority' => '0.5',
|
35
|
+
'changefreq' => 'daily'
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
|
3
|
+
$LOAD_PATH << File.expand_path("../../lib", __FILE__)
|
4
|
+
|
5
|
+
# Include support files
|
6
|
+
support_files_pattern = File.expand_path('../support/**/*.rb', __FILE__)
|
7
|
+
Dir.glob(support_files_pattern).each { |f| require f }
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
# Will be the default in RSpec 3
|
11
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
|
13
|
+
config.include MiddlemanServerHelpers, :feature
|
14
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'middleman/rack'
|
2
|
+
require 'rack/test'
|
3
|
+
|
4
|
+
module MiddlemanServerHelpers
|
5
|
+
include Rack::Test::Methods
|
6
|
+
|
7
|
+
def app
|
8
|
+
@app.call
|
9
|
+
end
|
10
|
+
|
11
|
+
def visit(path)
|
12
|
+
get(path)
|
13
|
+
raise last_response.errors if !last_response.errors.empty?
|
14
|
+
end
|
15
|
+
|
16
|
+
def find_on_page(string)
|
17
|
+
expect(last_response.body).to include(string)
|
18
|
+
end
|
19
|
+
|
20
|
+
def run_site(path, &block)
|
21
|
+
setup_environment(path)
|
22
|
+
|
23
|
+
@app = lambda do
|
24
|
+
instance = Middleman::Application.server.inst do
|
25
|
+
# Require the pagination extension after the
|
26
|
+
# server has booted, as would typically happen.
|
27
|
+
require File.expand_path('../../../lib/middleman_extension', __FILE__)
|
28
|
+
|
29
|
+
instance_exec(&block)
|
30
|
+
end
|
31
|
+
|
32
|
+
instance.class.to_rack_app
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def setup_environment(path)
|
39
|
+
ENV['MM_ROOT'] = File.expand_path("../../#{path}", __FILE__)
|
40
|
+
ENV['TEST'] = "true"
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module XmlHelpers
|
2
|
+
extend RSpec::Matchers::DSL
|
3
|
+
|
4
|
+
matcher :validate_against_schema do |schema|
|
5
|
+
@schema = schema
|
6
|
+
|
7
|
+
match do |actual|
|
8
|
+
xsd = Nokogiri::XML::Schema(File.read(@schema))
|
9
|
+
@validation_errors = xsd.validate(actual)
|
10
|
+
@validation_errors.empty?
|
11
|
+
end
|
12
|
+
|
13
|
+
failure_message_for_should do |actual|
|
14
|
+
num_errors = @validation_errors.length
|
15
|
+
error_count = "#{num_errors} error#{'s' if num_errors > 1}"
|
16
|
+
|
17
|
+
"expected XML to validate against #{@schema}, got #{error_count}:\n" +
|
18
|
+
@validation_errors.each_with_index.map do |error, i|
|
19
|
+
" #{i + 1}. #{error}"
|
20
|
+
end.join("\n")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
matcher :contain_node do |name|
|
25
|
+
match do |doc|
|
26
|
+
if @attributes
|
27
|
+
doc.css(name).detect do |node|
|
28
|
+
@attributes.all? { |k, v| node.css(k).text == v }
|
29
|
+
end
|
30
|
+
else
|
31
|
+
doc.at_css(name)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
chain :with_children do |attributes|
|
36
|
+
@attributes = attributes
|
37
|
+
end
|
38
|
+
|
39
|
+
failure_message_for_should do |doc|
|
40
|
+
expected_xml = "<#{name}>\n"
|
41
|
+
|
42
|
+
if @attributes
|
43
|
+
@attributes.each { |k,v| expected_xml << " <#{k}>#{v}</#{k}>\n" }
|
44
|
+
end
|
45
|
+
|
46
|
+
expected_xml << "</#{name}>"
|
47
|
+
|
48
|
+
"expected XML to contain:\n\n#{expected_xml}\n\ninstead got:\n\n#{doc.to_s}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-search_engine_sitemap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.rc
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pete Nicholls
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: middleman-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: builder
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: nokogiri
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Adds a sitemap.xml file (following the sitemaps.org protocol) to your
|
98
|
+
Middleman site for major search engines including Google.
|
99
|
+
email:
|
100
|
+
- pete@metanation.com
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".travis.yml"
|
107
|
+
- Gemfile
|
108
|
+
- LICENSE.txt
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- lib/middleman-search_engine_sitemap.rb
|
112
|
+
- lib/middleman/search_engine_sitemap.rb
|
113
|
+
- lib/middleman/search_engine_sitemap/templates/sitemap.xml.builder
|
114
|
+
- lib/middleman/search_engine_sitemap/version.rb
|
115
|
+
- lib/middleman_extension.rb
|
116
|
+
- middleman-search_engine_sitemap.gemspec
|
117
|
+
- sitemap.xsd
|
118
|
+
- spec/dummy/source/about.html
|
119
|
+
- spec/dummy/source/blog.html
|
120
|
+
- spec/dummy/source/home.html
|
121
|
+
- spec/dummy/source/layouts/layout.erb
|
122
|
+
- spec/features/sitemap_feature_spec.rb
|
123
|
+
- spec/spec_helper.rb
|
124
|
+
- spec/support/middleman_server_helpers.rb
|
125
|
+
- spec/support/xml_helpers.rb
|
126
|
+
homepage: https://github.com/Aupajo/middleman-search_engine_sitemap
|
127
|
+
licenses:
|
128
|
+
- MIT
|
129
|
+
metadata: {}
|
130
|
+
post_install_message:
|
131
|
+
rdoc_options: []
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 1.3.1
|
144
|
+
requirements: []
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 2.2.1
|
147
|
+
signing_key:
|
148
|
+
specification_version: 4
|
149
|
+
summary: Adds a sitemap.xml file to your Middleman site for search engines.
|
150
|
+
test_files:
|
151
|
+
- spec/dummy/source/about.html
|
152
|
+
- spec/dummy/source/blog.html
|
153
|
+
- spec/dummy/source/home.html
|
154
|
+
- spec/dummy/source/layouts/layout.erb
|
155
|
+
- spec/features/sitemap_feature_spec.rb
|
156
|
+
- spec/spec_helper.rb
|
157
|
+
- spec/support/middleman_server_helpers.rb
|
158
|
+
- spec/support/xml_helpers.rb
|