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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6aec1a24ba9b08938486a49d644a42b2d72e4e4
4
- data.tar.gz: ed96ebaa0ab1ef92c70ee3d0d347cd10d95b5c2d
3
+ metadata.gz: a94ace77445db68609654052b99b36b52dea329e
4
+ data.tar.gz: a4326897b2af686179153716b49d4c63aba21986
5
5
  SHA512:
6
- metadata.gz: 3059dfa28a7cf0e66c102f88cb2345f73e70621b877fb052509f6b2e717fd0047c50d5e5ae86e8832facb9c16ee1d078a7a9a02466d6d45a2e5f529d5e2678d0
7
- data.tar.gz: e0d81cc050cfa275040b2096daa6a278ac3fa8939f7b7d307141449f3d870ddfed8cc164693b228ee6eb30970efdbb2ec88baa032e5dcd9263336e8fd2f430f7
6
+ metadata.gz: e33afbff1c2ee244baf3491af460daf67559d8eab5c63a80b4d87ccdc7fae3beb5f806e43eb176977a20ea150004b433f710626711770c640970235d51440e78
7
+ data.tar.gz: f6cbe9370f5b0f15b5ffb98f6816ed8b74c83cdc09f5da67681f3cbda10fe2f852dbd9ea2db18cde7be0ac075d724e53b0b6315148d800e22dab491c4110a2f0
data/.travis.yml CHANGED
@@ -5,4 +5,4 @@ rvm:
5
5
  - 2.1.1
6
6
  - jruby-19mode
7
7
 
8
- script: "bundle exec rake test"
8
+ script: "bundle exec cucumber"
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
@@ -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-&amp;-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
@@ -0,0 +1,4 @@
1
+ ---
2
+ priority: 0.3
3
+ ---
4
+ Hello world!
@@ -0,0 +1,4 @@
1
+ ---
2
+ changefreq: weekly
3
+ ---
4
+ Something
@@ -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
- template = Tilt::ERBTemplate.new(File.expand_path(File.join("#{File.dirname(__FILE__)}", "../../templates/sitemap.xml.erb")))
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 "#{str}.html"
95
+ return str
95
96
  end
96
97
 
97
98
  end
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "middleman-sitemap"
6
- s.version = "0.0.11"
6
+ s.version = "0.0.12"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Larry Staton Jr."]
9
9
  s.email = ["larry@larrystaton.com"]
@@ -3,9 +3,12 @@
3
3
  <% @pages.each do |p| %>
4
4
  <url>
5
5
  <loc><%= @hostname + encode(p.url).gsub(/\/$/,'') %></loc>
6
- <lastmod><%= Date.today.to_time.iso8601 %></lastmod>
7
- <changefreq><%= p.data.changefreq || 'weekly' %></changefreq>
8
- <priority><%= p.data.priority || '0.5' %></priority>
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.11
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-03 00:00:00.000000000 Z
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: