jekyll-sitemap 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3323b2de7ce9cc47a7b7b19c452d9bf1cef594c
4
- data.tar.gz: 01899664a48e7ab22b86c53db7f77eec4a0c2920
3
+ metadata.gz: bbd83b460e4d33dd73021c31e3f8fa37d22aca7a
4
+ data.tar.gz: a49f5dcd79358e134a530dadb29ccee683f66960
5
5
  SHA512:
6
- metadata.gz: b29609605902d444e50be0d6880b0398ee705f8dac8e9d1b8cd8323b58791347c53723a9acc221d32e6e409455eacb7a87b99922c0b9c2031dfe5c5327de4240
7
- data.tar.gz: b3c3da0e33fb40c8145270326dc92614134d8cb8684f8eef0f5ab03647cd78542454118b5771a8948777c285ce88e917e99c31048112091949fd5c8c29fae582
6
+ metadata.gz: b859857ceda6fde59bd558cbb15f4f29e6340caa3a2ff1ee47f60fe4678dfafffa988bfedec4b2cde4a99e0f23972111174cd24902478b3add82117dadf50c1c
7
+ data.tar.gz: 8456e32b951ce0735cfeee995b215bab90c81e2fbed109d8dbd40dff54cedd5a2c88883557ad30a9891b8a51c952b181a73fceeccb4256c92bf9b287c1ceab3a
data/History.markdown CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.8.1 / 2015-03-11
2
+
3
+ * Do not assume all pages have changed (#35)
4
+ * Remove duplicated range from regex (#73)
5
+
1
6
  ## 0.8.0 / 2015-02-03
2
7
 
3
8
  * Call each page `page` in pages loop in `sitemap.xml` for clarity (#64)
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  ## Usage
8
8
 
9
- 1. Add `gem 'jekyll-sitemap'` to your site's Gemfile
9
+ 1. Add `gem 'jekyll-sitemap'` to your site's Gemfile and run `bundle`
10
10
  2. Add the following to your site's `_config.yml`:
11
11
 
12
12
  ```yml
@@ -3,7 +3,7 @@
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "jekyll-sitemap"
5
5
  spec.summary = "Automatically generate a sitemap.xml for your Jekyll site."
6
- spec.version = "0.8.0"
6
+ spec.version = "0.8.1"
7
7
  spec.authors = ["GitHub, Inc."]
8
8
  spec.email = "support@github.com"
9
9
  spec.homepage = "https://github.com/jekyll/jekyll-sitemap"
@@ -15,6 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.require_paths = ["lib"]
16
16
 
17
17
  spec.add_development_dependency "jekyll", "~> 2.0"
18
+ spec.add_development_dependency "jekyll-last-modified-at", "0.3.4"
18
19
  spec.add_development_dependency "rspec", "~> 3.0"
19
20
  spec.add_development_dependency "rake"
20
21
  spec.add_development_dependency "bundler", "~> 1.6"
@@ -9,6 +9,7 @@ module Jekyll
9
9
 
10
10
  class JekyllSitemap < Jekyll::Generator
11
11
  safe true
12
+ priority :lowest
12
13
 
13
14
  # Main plugin action, called by Jekyll-core
14
15
  def generate(site)
@@ -52,7 +53,7 @@ module Jekyll
52
53
  site_map.content = File.read(source_path)
53
54
  site_map.data["layout"] = nil
54
55
  site_map.render(Hash.new, @site.site_payload)
55
- site_map.output.gsub(/[\s\n]*\n+/, "\n")
56
+ site_map.output.gsub(/\s*\n+/, "\n")
56
57
  end
57
58
 
58
59
  # Checks if a sitemap already exists in the site source
data/lib/sitemap.xml CHANGED
@@ -14,14 +14,18 @@
14
14
  {% for page in site.html_pages %}{% unless page.sitemap == false %}
15
15
  <url>
16
16
  <loc>{{ page.url | replace:'/index.html','/' | prepend: site_url }}</loc>
17
- <lastmod>{{ site.time | date_to_xmlschema }}</lastmod>
17
+ {% if page.last_modified_at %}
18
+ <lastmod>{{ page.last_modified_at | date_to_xmlschema }}</lastmod>
19
+ {% endif %}
18
20
  </url>
19
21
  {% endunless %}{% endfor %}
20
22
  {% for collection in site.collections %}{% unless collection.last.output == false %}
21
23
  {% for doc in collection.last.docs %}{% unless doc.sitemap == false %}
22
24
  <url>
23
25
  <loc>{{ doc.url | replace:'/index.html','/' | prepend: site_url }}</loc>
24
- <lastmod>{{ site.time | date_to_xmlschema }}</lastmod>
26
+ {% if doc.last_modified_at %}
27
+ <lastmod>{{ doc.last_modified_at | date_to_xmlschema }}</lastmod>
28
+ {% endif %}
25
29
  </url>
26
30
  {% endunless %}{% endfor %}
27
31
  {% endunless %}{% endfor %}
data/script/cibuild CHANGED
@@ -1,3 +1,4 @@
1
1
  #! /bin/bash
2
2
 
3
3
  bundle exec rspec
4
+ bundle exec rspec spec/test_jekyll-last-modified-at.rb
@@ -1,7 +1,9 @@
1
+ timezone: UTC
2
+
1
3
  defaults:
2
4
  -
3
5
  scope:
4
6
  path: ""
5
7
  type: page
6
8
  values:
7
- layout: some_default
9
+ layout: some_default
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ Please don't modify this file. It's modified time is important.
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ This is a page with a modified time.
@@ -29,6 +29,11 @@ describe(Jekyll::JekyllSitemap) do
29
29
  expect(File.exist?(dest_dir("sitemap.xml"))).to be_truthy
30
30
  end
31
31
 
32
+ it "doesn't have multiple new lines or trailing whitespace" do
33
+ expect(contents).to_not match /\s+\n/
34
+ expect(contents).to_not match /\n{2,}/
35
+ end
36
+
32
37
  it "puts all the pages in the sitemap.xml file" do
33
38
  expect(contents).to match /<loc>http:\/\/example\.org\/<\/loc>/
34
39
  expect(contents).to match /<loc>http:\/\/example\.org\/some-subfolder\/this-is-a-subpage\.html<\/loc>/
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+ require 'jekyll-last-modified-at'
3
+
4
+ describe(Jekyll::JekyllSitemap) do
5
+ let(:overrides) do
6
+ {
7
+ "source" => source_dir,
8
+ "destination" => dest_dir,
9
+ "url" => "http://example.org",
10
+ "collections" => {
11
+ "my_collection" => { "output" => true },
12
+ "other_things" => { "output" => false }
13
+ }
14
+ }
15
+ end
16
+ let(:config) do
17
+ Jekyll.configuration(overrides)
18
+ end
19
+ let(:site) { Jekyll::Site.new(config) }
20
+ let(:contents) { File.read(dest_dir("sitemap.xml")) }
21
+ before(:each) do
22
+ site.process
23
+ end
24
+
25
+ context "with jekyll-last-modified-at" do
26
+ it "correctly adds the modified time to the posts" do
27
+ expect(contents).to match /<loc>http:\/\/example.org\/2015\/01\/18\/jekyll-last-modified-at.html<\/loc>\s+<lastmod>2015-01-19T07:03:38\+00:00<\/lastmod>/
28
+ end
29
+
30
+ it "correctly adds the modified time to the pages" do
31
+ expect(contents).to match /<loc>http:\/\/example.org\/jekyll-last-modified-at\/page.html<\/loc>\s+<lastmod>2015-01-19T07:03:38\+00:00<\/lastmod>/
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-sitemap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-03 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: jekyll-last-modified-at
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.4
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.4
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rspec
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -97,15 +111,18 @@ files:
97
111
  - spec/fixtures/_posts/2014-03-02-march-the-second.md
98
112
  - spec/fixtures/_posts/2014-03-04-march-the-fourth.md
99
113
  - spec/fixtures/_posts/2014-05-11-exclude-this-post.md
114
+ - spec/fixtures/_posts/2015-01-18-jekyll-last-modified-at.md
100
115
  - spec/fixtures/feeds/atom.xml
101
116
  - spec/fixtures/images/hubot.png
102
117
  - spec/fixtures/index.html
118
+ - spec/fixtures/jekyll-last-modified-at/page.html
103
119
  - spec/fixtures/some-subfolder/exclude-this-page.html
104
120
  - spec/fixtures/some-subfolder/test_index.html
105
121
  - spec/fixtures/some-subfolder/this-is-a-subfile.html
106
122
  - spec/fixtures/some-subfolder/this-is-a-subpage.html
107
123
  - spec/jekyll-sitemap_spec.rb
108
124
  - spec/spec_helper.rb
125
+ - spec/test_jekyll-last-modified-at.rb
109
126
  homepage: https://github.com/jekyll/jekyll-sitemap
110
127
  licenses:
111
128
  - MIT
@@ -141,12 +158,15 @@ test_files:
141
158
  - spec/fixtures/_posts/2014-03-02-march-the-second.md
142
159
  - spec/fixtures/_posts/2014-03-04-march-the-fourth.md
143
160
  - spec/fixtures/_posts/2014-05-11-exclude-this-post.md
161
+ - spec/fixtures/_posts/2015-01-18-jekyll-last-modified-at.md
144
162
  - spec/fixtures/feeds/atom.xml
145
163
  - spec/fixtures/images/hubot.png
146
164
  - spec/fixtures/index.html
165
+ - spec/fixtures/jekyll-last-modified-at/page.html
147
166
  - spec/fixtures/some-subfolder/exclude-this-page.html
148
167
  - spec/fixtures/some-subfolder/test_index.html
149
168
  - spec/fixtures/some-subfolder/this-is-a-subfile.html
150
169
  - spec/fixtures/some-subfolder/this-is-a-subpage.html
151
170
  - spec/jekyll-sitemap_spec.rb
152
171
  - spec/spec_helper.rb
172
+ - spec/test_jekyll-last-modified-at.rb