middleman-sitemap 0.0.11 → 0.0.12
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +2 -0
- data/features/encoding.feature +2 -2
- data/features/template.feature +26 -0
- data/fixtures/sitemap-frontmatter-app/config.rb +1 -0
- data/fixtures/sitemap-frontmatter-app/source/index.html +4 -0
- data/fixtures/sitemap-frontmatter-app/source/javascripts/test.js +0 -0
- data/fixtures/sitemap-frontmatter-app/source/something.html +4 -0
- data/fixtures/sitemap-frontmatter-app/source/stylesheets/test.css +0 -0
- data/fixtures/template-app/config.rb +1 -0
- data/fixtures/template-app/source/index.html +1 -0
- data/fixtures/template-app/source/javascripts/test.js +0 -0
- data/fixtures/template-app/source/something.html +1 -0
- data/fixtures/template-app/source/stylesheets/test.css +0 -0
- data/lib/middleman-sitemap/extension.rb +3 -2
- data/middleman-sitemap.gemspec +1 -1
- data/templates/sitemap.xml.erb +6 -3
- metadata +14 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a94ace77445db68609654052b99b36b52dea329e
|
|
4
|
+
data.tar.gz: a4326897b2af686179153716b49d4c63aba21986
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e33afbff1c2ee244baf3491af460daf67559d8eab5c63a80b4d87ccdc7fae3beb5f806e43eb176977a20ea150004b433f710626711770c640970235d51440e78
|
|
7
|
+
data.tar.gz: f6cbe9370f5b0f15b5ffb98f6816ed8b74c83cdc09f5da67681f3cbda10fe2f852dbd9ea2db18cde7be0ac075d724e53b0b6315148d800e22dab491c4110a2f0
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
|
@@ -21,6 +21,8 @@ If you already have a Middleman project: Add `gem "middleman-sitemap"` to your `
|
|
|
21
21
|
activate :sitemap
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
By default, `middleman-sitemap` will create a sitemap with `loc1 elements. As per the [protocol](http://www.sitemaps.org/protocol.html), the `lastmod`, `changefreq`, and `priority` elements are optional. To include these elements in your sitemap, you MUST include them in the front matter of your page.
|
|
25
|
+
|
|
24
26
|
## Options
|
|
25
27
|
|
|
26
28
|
### GZIP
|
data/features/encoding.feature
CHANGED
|
@@ -3,9 +3,9 @@ Feature: Encode HTML entities
|
|
|
3
3
|
Scenario: URLs in loc entities are HTML encoded
|
|
4
4
|
Given a successfully built app at "weird-urls-app"
|
|
5
5
|
When I cd to "build"
|
|
6
|
-
Then the file "sitemap.xml" should contain "http://www.example.com/this-&-that"
|
|
6
|
+
Then the file "sitemap.xml" should contain "<loc>http://www.example.com/this-&-that.html</loc>"
|
|
7
7
|
|
|
8
8
|
Scenario: Subdirectories
|
|
9
9
|
Given a successfully built app at "subdirectories-app"
|
|
10
10
|
When I cd to "build"
|
|
11
|
-
Then the file "sitemap.xml" should contain "http://www.example.com/error-pages/404.html"
|
|
11
|
+
Then the file "sitemap.xml" should contain "<loc>http://www.example.com/error-pages/404.html</loc>"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Feature: Default template
|
|
2
|
+
|
|
3
|
+
Scenario: Sitemap should have loc element
|
|
4
|
+
Given a successfully built app at "template-app"
|
|
5
|
+
When I cd to "build"
|
|
6
|
+
Then the file "sitemap.xml" should contain "<loc>http://www.example.com</loc>"
|
|
7
|
+
|
|
8
|
+
Scenario: Sitemap should not have lastmod element
|
|
9
|
+
Given a successfully built app at "template-app"
|
|
10
|
+
When I cd to "build"
|
|
11
|
+
Then the file "sitemap.xml" should not contain "<lastmod>"
|
|
12
|
+
|
|
13
|
+
Scenario: Sitemap should not have changefreq element
|
|
14
|
+
Given a successfully built app at "template-app"
|
|
15
|
+
When I cd to "build"
|
|
16
|
+
Then the file "sitemap.xml" should not contain "<changefreq>"
|
|
17
|
+
|
|
18
|
+
Scenario: Sitemap should not have priority element
|
|
19
|
+
Given a successfully built app at "template-app"
|
|
20
|
+
When I cd to "build"
|
|
21
|
+
Then the file "sitemap.xml" should not contain "<priority>"
|
|
22
|
+
|
|
23
|
+
Scenario: Page with relevant sitemap front matter should show up in sitemap
|
|
24
|
+
Given a successfully built app at "sitemap-frontmatter-app"
|
|
25
|
+
When I cd to "build"
|
|
26
|
+
Then the file "sitemap.xml" should contain "<priority>"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
activate :sitemap
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
activate :sitemap
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Hello world!
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Something
|
|
File without changes
|
|
@@ -54,7 +54,8 @@ class Sitemap < ::Middleman::Extension
|
|
|
54
54
|
def build_sitemap(name, pages)
|
|
55
55
|
@pages = pages
|
|
56
56
|
@hostname = options.hostname
|
|
57
|
-
|
|
57
|
+
templates_path = File.expand_path(File.join("#{File.dirname(__FILE__)}", "../../templates/sitemap.xml.erb"))
|
|
58
|
+
template = Tilt::ERBTemplate.new(templates_path, 0, :trim => '>')
|
|
58
59
|
sitemap = template.render(self)
|
|
59
60
|
|
|
60
61
|
outfile = File.join(app.build_dir, name)
|
|
@@ -91,7 +92,7 @@ class Sitemap < ::Middleman::Extension
|
|
|
91
92
|
# Returns a URL with proper HTML entities
|
|
92
93
|
def encode(path)
|
|
93
94
|
str = path.split("/").map { |f| app.escape_html(f) }.join("/")
|
|
94
|
-
return
|
|
95
|
+
return str
|
|
95
96
|
end
|
|
96
97
|
|
|
97
98
|
end
|
data/middleman-sitemap.gemspec
CHANGED
data/templates/sitemap.xml.erb
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
<% @pages.each do |p| %>
|
|
4
4
|
<url>
|
|
5
5
|
<loc><%= @hostname + encode(p.url).gsub(/\/$/,'') %></loc>
|
|
6
|
-
<lastmod><%=
|
|
7
|
-
|
|
8
|
-
<
|
|
6
|
+
<% if p.data.lastmod %> <lastmod><%= p.data.lastmod %></lastmod>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% if p.data.changefreq %> <changefreq><%= p.data.changefreq %></changefreq>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% if p.data.priority %> <priority><%= p.data.priority %></priority>
|
|
11
|
+
<% end %>
|
|
9
12
|
</url>
|
|
10
13
|
<% end %>
|
|
11
14
|
</urlset>
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: middleman-sitemap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Larry Staton Jr.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-04-
|
|
11
|
+
date: 2014-04-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: middleman-core
|
|
@@ -41,6 +41,7 @@ files:
|
|
|
41
41
|
- features/gzip.feature
|
|
42
42
|
- features/multiple_sitemaps.feature
|
|
43
43
|
- features/support/env.rb
|
|
44
|
+
- features/template.feature
|
|
44
45
|
- fixtures/gzip-app/config.rb
|
|
45
46
|
- fixtures/gzip-app/source/index.html
|
|
46
47
|
- fixtures/gzip-app/source/javascripts/test.js
|
|
@@ -51047,12 +51048,22 @@ files:
|
|
|
51047
51048
|
- fixtures/large-site-app/source/page50999.html
|
|
51048
51049
|
- fixtures/large-site-app/source/page51000.html
|
|
51049
51050
|
- fixtures/large-site-app/source/stylesheets/test.css
|
|
51051
|
+
- fixtures/sitemap-frontmatter-app/config.rb
|
|
51052
|
+
- fixtures/sitemap-frontmatter-app/source/index.html
|
|
51053
|
+
- fixtures/sitemap-frontmatter-app/source/javascripts/test.js
|
|
51054
|
+
- fixtures/sitemap-frontmatter-app/source/something.html
|
|
51055
|
+
- fixtures/sitemap-frontmatter-app/source/stylesheets/test.css
|
|
51050
51056
|
- fixtures/subdirectories-app/config.rb
|
|
51051
51057
|
- fixtures/subdirectories-app/source/error-pages/404.html
|
|
51052
51058
|
- fixtures/subdirectories-app/source/index.html
|
|
51053
51059
|
- fixtures/subdirectories-app/source/javascripts/test.js
|
|
51054
51060
|
- fixtures/subdirectories-app/source/stylesheets/test.css
|
|
51055
51061
|
- fixtures/subdirectories-app/source/this-&-that.html
|
|
51062
|
+
- fixtures/template-app/config.rb
|
|
51063
|
+
- fixtures/template-app/source/index.html
|
|
51064
|
+
- fixtures/template-app/source/javascripts/test.js
|
|
51065
|
+
- fixtures/template-app/source/something.html
|
|
51066
|
+
- fixtures/template-app/source/stylesheets/test.css
|
|
51056
51067
|
- fixtures/weird-urls-app/config.rb
|
|
51057
51068
|
- fixtures/weird-urls-app/source/index.html
|
|
51058
51069
|
- fixtures/weird-urls-app/source/javascripts/test.js
|
|
@@ -51093,4 +51104,5 @@ test_files:
|
|
|
51093
51104
|
- features/gzip.feature
|
|
51094
51105
|
- features/multiple_sitemaps.feature
|
|
51095
51106
|
- features/support/env.rb
|
|
51107
|
+
- features/template.feature
|
|
51096
51108
|
has_rdoc:
|