jekyll-sitemap 1.3.1 → 1.4.0
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/.gitignore +2 -1
- data/.rubocop.yml +4 -0
- data/.travis.yml +2 -3
- data/History.markdown +10 -0
- data/jekyll-sitemap.gemspec +0 -1
- data/lib/jekyll-sitemap/version.rb +1 -1
- data/lib/jekyll/jekyll-sitemap.rb +5 -5
- data/spec/jekyll-sitemap_spec.rb +50 -1
- data/spec/robot-fixtures/page-at-root/robots.txt +4 -0
- data/spec/robot-fixtures/permalinked-page-in-subdir/assets/robots.txt +5 -0
- data/spec/robot-fixtures/static-at-source-root/robots.txt +1 -0
- data/spec/robot-fixtures/static-in-subdir/assets/robots.txt +1 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/test_jekyll-last-modified-at.rb +17 -3
- metadata +11 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcd7dced46edc1fe61d6b0ccfd9574a07c4ea10fcf171b57cda3dfc72b078de4
|
4
|
+
data.tar.gz: 27a727b6359318f89161b868810cee74637685d8af0f25c2d4211856ea3391b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 368433ab557a4d3b20dee8fd99c2f59e25777ae8ad58510e2542486154caad8717af3584ba55da7b841b84414abaadb7b97998026a8e22bee4c42208ad6a0e73
|
7
|
+
data.tar.gz: 7f25e64a6d1f32e51e92e9a17c4c44f333dfdb79432bebd31b25d74281a9c95d42cb2691192759e040c81b62ba5b867b2fce320599fb851b1c30acdb1e25110f
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -3,16 +3,15 @@ cache: bundler
|
|
3
3
|
rvm:
|
4
4
|
- &latest_ruby 2.6
|
5
5
|
- 2.4
|
6
|
-
- 2.3
|
7
6
|
matrix:
|
8
7
|
include:
|
9
8
|
# GitHub Pages
|
10
9
|
- rvm: 2.5.3
|
11
10
|
env:
|
12
|
-
- JEKYLL_VERSION="~> 3.
|
11
|
+
- JEKYLL_VERSION="~> 3.8.5"
|
13
12
|
- GITHUB_PAGES=1 # Only set on one build in matrix
|
14
13
|
- rvm: *latest_ruby
|
15
|
-
env: JEKYLL_VERSION=">= 4.0.0
|
14
|
+
env: JEKYLL_VERSION=">= 4.0.0"
|
16
15
|
env:
|
17
16
|
matrix:
|
18
17
|
- JEKYLL_VERSION="~> 3.8"
|
data/History.markdown
CHANGED
data/jekyll-sitemap.gemspec
CHANGED
@@ -23,7 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency "jekyll", ">= 3.7", "< 5.0"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "jekyll-last-modified-at", "~> 1.0"
|
27
26
|
spec.add_development_dependency "rake"
|
28
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
28
|
spec.add_development_dependency "rubocop-jekyll", "~> 0.4"
|
@@ -62,11 +62,11 @@ module Jekyll
|
|
62
62
|
|
63
63
|
# Checks if a file already exists in the site source
|
64
64
|
def file_exists?(file_path)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
pages_and_files.any? { |p| p.url == "/#{file_path}" }
|
66
|
+
end
|
67
|
+
|
68
|
+
def pages_and_files
|
69
|
+
@pages_and_files ||= @site.pages + @site.static_files
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
data/spec/jekyll-sitemap_spec.rb
CHANGED
@@ -195,7 +195,7 @@ describe(Jekyll::JekyllSitemap) do
|
|
195
195
|
expect(contents).not_to match(%r!\ATHIS IS MY LAYOUT!)
|
196
196
|
end
|
197
197
|
|
198
|
-
it "creates a
|
198
|
+
it "creates a robots.txt file" do
|
199
199
|
expect(File.exist?(dest_dir("robots.txt"))).to be_truthy
|
200
200
|
end
|
201
201
|
|
@@ -204,4 +204,53 @@ describe(Jekyll::JekyllSitemap) do
|
|
204
204
|
end
|
205
205
|
end
|
206
206
|
end
|
207
|
+
|
208
|
+
context "with user-defined robots.txt" do
|
209
|
+
let(:fixture) { "/" }
|
210
|
+
let(:fixture_source) { robot_fixtures(fixture) }
|
211
|
+
let(:fixture_dest) { robot_fixtures(fixture, "_site") }
|
212
|
+
let(:robot_contents) { File.read(robot_fixtures(fixture, "_site", "robots.txt")).strip }
|
213
|
+
let(:overrides) do
|
214
|
+
{
|
215
|
+
"source" => fixture_source,
|
216
|
+
"destination" => fixture_dest,
|
217
|
+
"url" => "http://example.org",
|
218
|
+
}
|
219
|
+
end
|
220
|
+
|
221
|
+
before(:each) { setup_fixture(fixture) }
|
222
|
+
after(:each) { cleanup_fixture(fixture) }
|
223
|
+
|
224
|
+
context "as a static-file at source-root" do
|
225
|
+
let(:fixture) { "static-at-source-root" }
|
226
|
+
|
227
|
+
it "doesn't override the robots file" do
|
228
|
+
expect(robot_contents).to eql("Allow: /")
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
context "as a static-file in a subdir" do
|
233
|
+
let(:fixture) { "static-in-subdir" }
|
234
|
+
|
235
|
+
it "generates a valid robot.txt" do
|
236
|
+
expect(robot_contents).to eql("Sitemap: http://example.org/sitemap.xml")
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
context "as a page at root" do
|
241
|
+
let(:fixture) { "page-at-root" }
|
242
|
+
|
243
|
+
it "doesn't override the robots file" do
|
244
|
+
expect(robot_contents).to eql("Allow: http://example.org")
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
context "as a page with permalink in a subdir" do
|
249
|
+
let(:fixture) { "permalinked-page-in-subdir" }
|
250
|
+
|
251
|
+
it "doesn't override the robots file" do
|
252
|
+
expect(robot_contents).to eql("Allow: http://example.org")
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
207
256
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Allow: /
|
@@ -0,0 +1 @@
|
|
1
|
+
Allow: /
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "jekyll"
|
4
|
+
require "fileutils"
|
4
5
|
require File.expand_path("../lib/jekyll-sitemap", __dir__)
|
5
6
|
|
6
7
|
Jekyll.logger.log_level = :error
|
@@ -12,6 +13,8 @@ RSpec.configure do |config|
|
|
12
13
|
|
13
14
|
SOURCE_DIR = File.expand_path("fixtures", __dir__)
|
14
15
|
DEST_DIR = File.expand_path("dest", __dir__)
|
16
|
+
ROBOT_FIXTURES = File.expand_path("robot-fixtures", __dir__)
|
17
|
+
ROBOT_FIXTURE_ITEMS = %w(_posts _layouts _config.yml index.html).freeze
|
15
18
|
|
16
19
|
def source_dir(*files)
|
17
20
|
File.join(SOURCE_DIR, *files)
|
@@ -20,4 +23,18 @@ RSpec.configure do |config|
|
|
20
23
|
def dest_dir(*files)
|
21
24
|
File.join(DEST_DIR, *files)
|
22
25
|
end
|
26
|
+
|
27
|
+
def robot_fixtures(*subdirs)
|
28
|
+
File.join(ROBOT_FIXTURES, *subdirs)
|
29
|
+
end
|
30
|
+
|
31
|
+
def setup_fixture(directory)
|
32
|
+
ROBOT_FIXTURE_ITEMS.each { |item| FileUtils.cp_r(source_dir(item), robot_fixtures(directory)) }
|
33
|
+
end
|
34
|
+
|
35
|
+
def cleanup_fixture(directory, dest_dirname = "_site")
|
36
|
+
(ROBOT_FIXTURE_ITEMS + [dest_dirname]).each do |item|
|
37
|
+
FileUtils.remove_entry(robot_fixtures(directory, item))
|
38
|
+
end
|
39
|
+
end
|
23
40
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "spec_helper"
|
4
|
-
require "jekyll-last-modified-at"
|
5
4
|
|
6
5
|
describe(Jekyll::JekyllSitemap) do
|
7
6
|
let(:overrides) do
|
@@ -21,16 +20,31 @@ describe(Jekyll::JekyllSitemap) do
|
|
21
20
|
let(:site) { Jekyll::Site.new(config) }
|
22
21
|
let(:contents) { File.read(dest_dir("sitemap.xml")) }
|
23
22
|
before(:each) do
|
23
|
+
# simulate `last_modified_at` injection by `jekyll-last-modified-at` plugin
|
24
|
+
Jekyll::Hooks.register([:pages, :documents], :post_init) do |page|
|
25
|
+
page.data["last_modified_at"] = Time.parse("2015-01-18T00:00:00+00:00")
|
26
|
+
end
|
27
|
+
|
24
28
|
site.process
|
25
29
|
end
|
26
30
|
|
27
31
|
context "with jekyll-last-modified-at" do
|
28
32
|
it "correctly adds the modified time to the posts" do
|
29
|
-
expect(contents).to match
|
33
|
+
expect(contents).to match(
|
34
|
+
%r!
|
35
|
+
<loc>http://example.org/2015/01/18/jekyll-last-modified-at.html</loc>\s+
|
36
|
+
<lastmod>2015-01-18T00:00:00\+00:00</lastmod>
|
37
|
+
!x
|
38
|
+
)
|
30
39
|
end
|
31
40
|
|
32
41
|
it "correctly adds the modified time to the pages" do
|
33
|
-
expect(contents).to match
|
42
|
+
expect(contents).to match(
|
43
|
+
%r!
|
44
|
+
<loc>http://example.org/jekyll-last-modified-at/page.html</loc>\s+
|
45
|
+
<lastmod>2015-01-18T00:00:00\+00:00</lastmod>
|
46
|
+
!x
|
47
|
+
)
|
34
48
|
end
|
35
49
|
end
|
36
50
|
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: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -44,20 +44,6 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: jekyll-last-modified-at
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - "~>"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '1.0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - "~>"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '1.0'
|
61
47
|
- !ruby/object:Gem::Dependency
|
62
48
|
name: rake
|
63
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,6 +147,10 @@ files:
|
|
161
147
|
- spec/fixtures/static_files/html_file.html
|
162
148
|
- spec/fixtures/static_files/test.pdf
|
163
149
|
- spec/jekyll-sitemap_spec.rb
|
150
|
+
- spec/robot-fixtures/page-at-root/robots.txt
|
151
|
+
- spec/robot-fixtures/permalinked-page-in-subdir/assets/robots.txt
|
152
|
+
- spec/robot-fixtures/static-at-source-root/robots.txt
|
153
|
+
- spec/robot-fixtures/static-in-subdir/assets/robots.txt
|
164
154
|
- spec/spec_helper.rb
|
165
155
|
- spec/test_jekyll-last-modified-at.rb
|
166
156
|
homepage: https://github.com/jekyll/jekyll-sitemap
|
@@ -182,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
172
|
- !ruby/object:Gem::Version
|
183
173
|
version: '0'
|
184
174
|
requirements: []
|
185
|
-
rubygems_version: 3.0.
|
175
|
+
rubygems_version: 3.0.6
|
186
176
|
signing_key:
|
187
177
|
specification_version: 4
|
188
178
|
summary: Automatically generate a sitemap.xml for your Jekyll site.
|
@@ -219,5 +209,9 @@ test_files:
|
|
219
209
|
- spec/fixtures/static_files/html_file.html
|
220
210
|
- spec/fixtures/static_files/test.pdf
|
221
211
|
- spec/jekyll-sitemap_spec.rb
|
212
|
+
- spec/robot-fixtures/page-at-root/robots.txt
|
213
|
+
- spec/robot-fixtures/permalinked-page-in-subdir/assets/robots.txt
|
214
|
+
- spec/robot-fixtures/static-at-source-root/robots.txt
|
215
|
+
- spec/robot-fixtures/static-in-subdir/assets/robots.txt
|
222
216
|
- spec/spec_helper.rb
|
223
217
|
- spec/test_jekyll-last-modified-at.rb
|