jekyll-sitemap 0.4.1 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c82fc264e84cf81d8517c86db2f0d9653e8f1668
4
- data.tar.gz: 91a7d2942b735f336b0228207216a07103ed21ff
3
+ metadata.gz: 08aeee9c78b3fe0667703cae93abcd7209f782df
4
+ data.tar.gz: 4d3ac34c308fb62c6f4ea9349a5e4515522cb574
5
5
  SHA512:
6
- metadata.gz: c27f09fdc6c694bde3dfd3b14f50704146e6f202ad5b62f1a0b0aedafbc6c7f94a174fc24ee3321451287f28ecbe6af856cac26e1634a726440b3da3a810b93c
7
- data.tar.gz: a7aea97eabdc31dff65f0c45a1a321bf382d8397dfed91383bee0ee112b4689a275acd6abafbde6136cc471adeaeb37f5aa13f279a6424491c8529dd5c76b6bf
6
+ metadata.gz: 7f7dd3c72ce37330affc7ddb67f9ea1309198e5841cb54e9f77e11c1f65ae5af1ce091cb95f30483b9244509491320e248f69fb10b709913583d23a630c525ba
7
+ data.tar.gz: f6d802042235cb1d8610967944c16262365eff95197b4ad9cb41b893441122cb6eecbcdf0e5f7cd4534c5f107d36446fea9aad98d0fb45d7b22c9b06992dc2a1
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ Gemfile.lock
3
+ spec/dest
4
+ .bundle
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1
4
+ - 2.0.0
5
+ - 1.9.3
6
+ script: "script/cibuild"
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/History.markdown ADDED
@@ -0,0 +1,47 @@
1
+ ## HEAD
2
+
3
+ ## 0.5.0 / 2014-06-02
4
+
5
+ ### Minor Enhancements
6
+
7
+ * Allow users to exclude a page/post from the sitemap (#11)
8
+
9
+ ## 0.4.1 / 2014-05-10
10
+
11
+ ### Bug Fixes
12
+
13
+ * Force sitemap layout to be `nil` (#16)
14
+ * Correct seconds in timestamp for static files (#24)
15
+
16
+ # Development Fixes
17
+
18
+ * Upgrade to Rspec 3.0 and use `be_truthy` (#24)
19
+
20
+ ## 0.4.0 / 2014-05-06
21
+
22
+ ### Major Enhancements
23
+
24
+ * Support Jekyll 2.0 (#12)
25
+
26
+ ## 0.3.0 / 2014-05-05
27
+
28
+ ### Minor Enhancements
29
+
30
+ * Generate sitemap using html_pages (#10)
31
+
32
+ ### Bug Fixes
33
+
34
+ * Remove stray sitemap.xsl from template (#8)
35
+
36
+ ### Development Fixes
37
+
38
+ * Added travis (#6)
39
+ * Better timezone support (#7)
40
+
41
+ ## 0.2.0 / 2014-03-24
42
+
43
+ * Loosen Jekyll requirement (#4)
44
+
45
+ ## 0.1.0 / 2014-03-15
46
+
47
+ * Birthday!
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 GitHub, inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Jekyll Sitemap Generator Plugin
2
+
3
+ *Jekyll plugin to silently generate a sitemaps.org compliant sitemap for your Jekyll site*
4
+
5
+ [![Build Status](https://travis-ci.org/jekyll/jekyll-sitemap.svg?branch=master)](https://travis-ci.org/jekyll/jekyll-sitemap)
6
+
7
+ ## Usage
8
+
9
+ 1. Add `gem 'jekyll-sitemap'` to your site's Gemfile
10
+ 2. Add the following to your site's `_config.yml`:
11
+
12
+ ```yml
13
+ gems:
14
+ - jekyll-sitemap
15
+ ```
16
+
17
+ ## Developing locally
18
+
19
+ Use `script/bootstrap` to bootstrap your local development environment.
20
+
21
+ Use `script/console` to load a local IRB console with the Gem.
22
+
23
+ ## Testing
24
+
25
+ 1. `script/bootstrap`
26
+ 2. `script/cibuild`
27
+
28
+ ## Contributing
29
+
30
+ 1. Fork the project
31
+ 2. Create a descriptively named feature branch
32
+ 3. Add your feature
33
+ 4. Submit a pull request
34
+
35
+ ## Issues
36
+ 1. If the `sitemap.xml` doesn't generate in the `\_site` folder ensure `\_config.yml` doesn't have `safe: true`. That prevents all plugins from working.
37
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "jekyll-sitemap"
5
+ spec.summary = "Automatically generate a sitemap.xml for your Jekyll site."
6
+ spec.version = "0.5.0"
7
+ spec.authors = ["GitHub, Inc."]
8
+ spec.email = "support@github.com"
9
+ spec.homepage = "https://github.com/jekyll/jekyll-sitemap"
10
+ spec.licenses = ["MIT"]
11
+
12
+ spec.files = `git ls-files -z`.split("\x0")
13
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_development_dependency "jekyll", "~> 2.0"
18
+ spec.add_development_dependency "rspec", "~> 3.0"
19
+ spec.add_development_dependency "rake"
20
+ spec.add_development_dependency "bundler", "~> 1.6"
21
+ end
data/lib/sitemap.xml CHANGED
@@ -1,25 +1,25 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
3
  {% capture site_url %}{% if site.url %}{{ site.url }}{% else %}{{ site.github.url }}{% endif %}{% endcapture %}
4
- {% for post in site.posts %}
4
+ {% for post in site.posts %}{% unless post.sitemap == false %}
5
5
  <url>
6
6
  <loc>{{ site_url }}{{ post.url }}</loc>
7
7
  <lastmod>{{ post.date | date_to_xmlschema }}</lastmod>
8
8
  <priority>0.8</priority>
9
9
  </url>
10
- {% endfor %}
11
- {% for post in site.html_pages %}
10
+ {% endunless %}{% endfor %}
11
+ {% for post in site.html_pages %}{% unless post.sitemap == false %}
12
12
  <url>
13
13
  <loc>{{ site_url }}{{ post.url | replace:'index.html','' }}</loc>
14
14
  <lastmod>{{ site.time | date_to_xmlschema }}</lastmod>
15
15
  <changefreq>weekly</changefreq>
16
16
  <priority>{% if post.url == "/" or post.url == "/index.html" %}1.0{% else %}0.7{% endif %}</priority>
17
17
  </url>
18
- {% endfor %}
18
+ {% endunless %}{% endfor %}
19
19
  {% for file in site.html_files %}
20
20
  <url>
21
21
  <loc>{{ site_url }}{{ file.path }}</loc>
22
- <lastmod>{{ file.modified_time | date:"%Y-%m-%dT%H:%M:%sZ" }}</lastmod>
22
+ <lastmod>{{ file.modified_time | date:"%Y-%m-%dT%H:%M:%SZ" }}</lastmod>
23
23
  <priority>0.6</priority>
24
24
  </url>
25
25
  {% endfor %}
data/script/bootstrap ADDED
@@ -0,0 +1,3 @@
1
+ #! /bin/bash
2
+
3
+ bundle install
data/script/cibuild ADDED
@@ -0,0 +1,3 @@
1
+ #! /bin/bash
2
+
3
+ bundle exec rspec
data/script/console ADDED
@@ -0,0 +1,34 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ def relative_to_root(path)
4
+ File.expand_path(path, File.dirname(File.dirname(__FILE__)))
5
+ end
6
+
7
+ require 'jekyll'
8
+ require relative_to_root('lib/jekyll-sitemap.rb')
9
+ require 'pry-debugger'
10
+
11
+ SOURCE_DIR = relative_to_root('spec/fixtures')
12
+ DEST_DIR = relative_to_root('spec/dest')
13
+
14
+ def source_dir(*files)
15
+ File.join(SOURCE_DIR, *files)
16
+ end
17
+
18
+ def dest_dir(*files)
19
+ File.join(DEST_DIR, *files)
20
+ end
21
+
22
+ def config(overrides = {})
23
+ Jekyll.configuration({
24
+ "source" => source_dir,
25
+ "destination" => dest_dir,
26
+ "url" => "http://example.org"
27
+ }).merge(overrides)
28
+ end
29
+
30
+ def site(configuration = config)
31
+ Jekyll::Site.new(configuration)
32
+ end
33
+
34
+ binding.pry
data/script/release ADDED
@@ -0,0 +1,42 @@
1
+ #!/bin/sh
2
+ # Tag and push a release.
3
+
4
+ set -e
5
+
6
+ # Make sure we're in the project root.
7
+
8
+ cd $(dirname "$0")/..
9
+
10
+ # Make sure the darn thing works
11
+
12
+ bundle update
13
+
14
+ # Build a new gem archive.
15
+
16
+ rm -rf jekyll-sitemap-*.gem
17
+ gem build -q jekyll-sitemap.gemspec
18
+
19
+ # Make sure we're on the master branch.
20
+
21
+ (git branch | grep -q '* master') || {
22
+ echo "Only release from the master branch."
23
+ exit 1
24
+ }
25
+
26
+ # Figure out what version we're releasing.
27
+
28
+ tag=v`ls jekyll-sitemap-*.gem | sed 's/^jekyll-sitemap-\(.*\)\.gem$/\1/'`
29
+
30
+ # Make sure we haven't released this version before.
31
+
32
+ git fetch -t origin
33
+
34
+ (git tag -l | grep -q "$tag") && {
35
+ echo "Whoops, there's already a '${tag}' tag."
36
+ exit 1
37
+ }
38
+
39
+ # Tag it and bag it.
40
+
41
+ gem push jekyll-sitemap-*.gem && git tag "$tag" &&
42
+ git push origin master && git push origin "$tag"
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ December the twelfth, actually.
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ March the second!
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ March the fourth!
@@ -0,0 +1,5 @@
1
+ ---
2
+ sitemap: false
3
+ ---
4
+
5
+ This post should not appear in the sitemap.
@@ -0,0 +1,6 @@
1
+ ---
2
+ ---
3
+
4
+ <?xml version="1.0" encoding="utf-8"?>
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ </feed>
Binary file
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ HERE IS MY SITE I AM SO EXCITED TO BE USING GITHUB PAGES
@@ -0,0 +1,5 @@
1
+ ---
2
+ sitemap: false
3
+ ---
4
+
5
+ Exclude this page
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ This is a subpage!
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+
3
+ describe(Jekyll::JekyllSitemap) do
4
+ let(:config) do
5
+ Jekyll.configuration({
6
+ "source" => source_dir,
7
+ "destination" => dest_dir,
8
+ "url" => "http://example.org"
9
+ })
10
+ end
11
+ let(:site) { Jekyll::Site.new(config) }
12
+ let(:contents) { File.read(dest_dir("sitemap.xml")) }
13
+ before(:each) do
14
+ site.process
15
+ end
16
+
17
+ it "creates a sitemap.xml file" do
18
+ expect(File.exist?(dest_dir("sitemap.xml"))).to be_truthy
19
+ end
20
+
21
+ it "sets the base URL for the site as priority 1.0" do
22
+ expect(contents).to match /<loc>http:\/\/example\.org\/<\/loc>\s+<lastmod>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(-|\+)\d{2}:\d{2}<\/lastmod>\s+<changefreq>weekly<\/changefreq>\s+<priority>1\.0<\/priority>/
23
+ end
24
+
25
+ it "puts all the pages in the sitemap.xml file" do
26
+ expect(contents).to match /<loc>http:\/\/example\.org\/<\/loc>/
27
+ expect(contents).to match /<loc>http:\/\/example\.org\/some-subfolder\/this-is-a-subpage\.html<\/loc>/
28
+ end
29
+
30
+ it "puts all the posts in the sitemap.xml file" do
31
+ expect(contents).to match /<loc>http:\/\/example\.org\/2014\/03\/04\/march-the-fourth\.html<\/loc>/
32
+ expect(contents).to match /<loc>http:\/\/example\.org\/2014\/03\/02\/march-the-second\.html<\/loc>/
33
+ expect(contents).to match /<loc>http:\/\/example\.org\/2013\/12\/12\/dec-the-second\.html<\/loc>/
34
+ end
35
+
36
+ it "generates the correct date for each of the posts" do
37
+ expect(contents).to match /<lastmod>2014-03-04T00:00:00(-|\+)\d+:\d+<\/lastmod>/
38
+ expect(contents).to match /<lastmod>2014-03-02T00:00:00(-|\+)\d+:\d+<\/lastmod>/
39
+ expect(contents).to match /<lastmod>2013-12-12T00:00:00(-|\+)\d+:\d+<\/lastmod>/
40
+ end
41
+
42
+ it "puts all the static HTML files in the sitemap.xml file" do
43
+ expect(contents).to match /<loc>http:\/\/example\.org\/some-subfolder\/this-is-a-subfile\.html<\/loc>/
44
+ end
45
+
46
+ it "does not include assets or any static files that aren't .html" do
47
+ expect(contents).not_to match /<loc>http:\/\/example\.org\/images\/hubot\.png<\/loc>/
48
+ expect(contents).not_to match /<loc>http:\/\/example\.org\/feeds\/atom\.xml<\/loc>/
49
+ end
50
+
51
+ it "does not include posts that have set 'sitemap: false'" do
52
+ expect(contents).not_to match /\/exclude-this-post\.html<\/loc>/
53
+ end
54
+
55
+ it "does not include pages that have set 'sitemap: false'" do
56
+ expect(contents).not_to match /\/exclude-this-page\.html<\/loc>/
57
+ end
58
+
59
+ it "correctly formats timestamps of static files" do
60
+ expect(contents).to match /\/this-is-a-subfile\.html<\/loc>\s+<lastmod>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z<\/lastmod>/
61
+ end
62
+ end
@@ -0,0 +1,21 @@
1
+ require 'jekyll'
2
+ require File.expand_path('../lib/jekyll-sitemap', File.dirname(__FILE__))
3
+
4
+ Jekyll.logger.log_level = :error
5
+
6
+ RSpec.configure do |config|
7
+ config.run_all_when_everything_filtered = true
8
+ config.filter_run :focus
9
+ config.order = 'random'
10
+
11
+ SOURCE_DIR = File.expand_path("../fixtures", __FILE__)
12
+ DEST_DIR = File.expand_path("../dest", __FILE__)
13
+
14
+ def source_dir(*files)
15
+ File.join(SOURCE_DIR, *files)
16
+ end
17
+
18
+ def dest_dir(*files)
19
+ File.join(DEST_DIR, *files)
20
+ end
21
+ 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.4.1
4
+ version: 0.5.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: 2014-05-10 00:00:00.000000000 Z
11
+ date: 2014-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -17,7 +17,7 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.0'
20
- type: :runtime
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '3.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,15 +52,54 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.6'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.6'
55
69
  description:
56
70
  email: support@github.com
57
71
  executables: []
58
72
  extensions: []
59
73
  extra_rdoc_files: []
60
74
  files:
75
+ - ".gitignore"
76
+ - ".rspec"
77
+ - ".travis.yml"
78
+ - Gemfile
79
+ - History.markdown
80
+ - LICENSE.md
81
+ - README.md
82
+ - Rakefile
83
+ - jekyll-sitemap.gemspec
61
84
  - lib/jekyll-sitemap.rb
62
85
  - lib/sitemap.xml
63
- homepage: https://github.com/github/jekyll-sitemap
86
+ - script/bootstrap
87
+ - script/cibuild
88
+ - script/console
89
+ - script/release
90
+ - spec/fixtures/_posts/2013-12-12-dec-the-second.md
91
+ - spec/fixtures/_posts/2014-03-02-march-the-second.md
92
+ - spec/fixtures/_posts/2014-03-04-march-the-fourth.md
93
+ - spec/fixtures/_posts/2014-05-11-exclude-this-post.md
94
+ - spec/fixtures/feeds/atom.xml
95
+ - spec/fixtures/images/hubot.png
96
+ - spec/fixtures/index.html
97
+ - spec/fixtures/some-subfolder/exclude-this-page.html
98
+ - spec/fixtures/some-subfolder/this-is-a-subfile.html
99
+ - spec/fixtures/some-subfolder/this-is-a-subpage.html
100
+ - spec/jekyll-sitemap_spec.rb
101
+ - spec/spec_helper.rb
102
+ homepage: https://github.com/jekyll/jekyll-sitemap
64
103
  licenses:
65
104
  - MIT
66
105
  metadata: {}
@@ -84,4 +123,16 @@ rubygems_version: 2.2.2
84
123
  signing_key:
85
124
  specification_version: 4
86
125
  summary: Automatically generate a sitemap.xml for your Jekyll site.
87
- test_files: []
126
+ test_files:
127
+ - spec/fixtures/_posts/2013-12-12-dec-the-second.md
128
+ - spec/fixtures/_posts/2014-03-02-march-the-second.md
129
+ - spec/fixtures/_posts/2014-03-04-march-the-fourth.md
130
+ - spec/fixtures/_posts/2014-05-11-exclude-this-post.md
131
+ - spec/fixtures/feeds/atom.xml
132
+ - spec/fixtures/images/hubot.png
133
+ - spec/fixtures/index.html
134
+ - spec/fixtures/some-subfolder/exclude-this-page.html
135
+ - spec/fixtures/some-subfolder/this-is-a-subfile.html
136
+ - spec/fixtures/some-subfolder/this-is-a-subpage.html
137
+ - spec/jekyll-sitemap_spec.rb
138
+ - spec/spec_helper.rb