jekyll-sitemap 0.6.3 → 0.7.0

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: b8404cca92ec1c9c3be35db7d6c28c5ec99267a3
4
- data.tar.gz: 9f1afcf5fe3b94a29c89cda2d4a387d57c7aaa5f
3
+ metadata.gz: 63fc14261e170a339f8c31cb7944a2dff1701aa0
4
+ data.tar.gz: 8ac3ae2638c6aaa04aa295bfccb80a6e4dd24c36
5
5
  SHA512:
6
- metadata.gz: 9480487c055cc658c9765b01b0d4c51448943128ce4be9e10a60103d505d600d69b2b062df34ff2b1c43144f958781130b6cfcacba1056b631ba758cc28eb2a5
7
- data.tar.gz: f526d084eafa64b35b79c1c56677a6e7d2fa5b5532f3e848af9cdcb4b2eeddde9875c961b764f1c809a4aea31a3f35dabec2bd6d0b13ca696b991f7bac6ac5c4
6
+ metadata.gz: 425ab53b7c2f6f6c1348e96cd2549d63f07984319358c0225dd42d8308e7b2c5c845765caa933a3188170abda1bb3b88d46b785bf4d47f15cbc1a50003c568d7
7
+ data.tar.gz: 09e7485fd2663ed700ecfdd9ded5a05455c5e46a82f82236bfad375c29c96704dd77653e0af11ab76a58f2051dcd2dd541b0288412190d51095e3f154b0a95da
data/History.markdown CHANGED
@@ -1,3 +1,14 @@
1
+ ## 0.7.0 / 2014-12-07
2
+
3
+ ## Minor Enhancements
4
+
5
+ * Make `site.baseurl` support more robust (#59)
6
+ * Add `site.baseurl` to base site URL construction (#50)
7
+
8
+ ## Development Fixes
9
+
10
+ * Remove unnecessary spaces and escaping in README (#58)
11
+
1
12
  ## 0.6.3 / 2014-11-11
2
13
 
3
14
  ## Bug Fixes
data/README.md CHANGED
@@ -24,7 +24,7 @@ include the generated content from the gems. (Programming is *hard*.)
24
24
 
25
25
  ## Exclusions
26
26
 
27
- If you would like to exclude specific pages/posts from the sitemap set the
27
+ If you would like to exclude specific pages/posts from the sitemap set the
28
28
  sitemap flag to `false` in the front matter for the page/post.
29
29
 
30
30
  ```yml
@@ -50,7 +50,6 @@ Use `script/console` to load a local IRB console with the Gem.
50
50
  4. Submit a pull request
51
51
 
52
52
  ## Issues
53
- 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.
54
- 2. If the `sitemap.xml` doesn't generate in the `\_site` folder, ensure that you don't have a sitemap generator plugin in your `_plugin` folder.
55
-
56
53
 
54
+ 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.
55
+ 2. If the `sitemap.xml` doesn't generate in the `_site` folder, ensure that you don't have a sitemap generator plugin in your `_plugin` folder.
@@ -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.6.3"
6
+ spec.version = "0.7.0"
7
7
  spec.authors = ["GitHub, Inc."]
8
8
  spec.email = "support@github.com"
9
9
  spec.homepage = "https://github.com/jekyll/jekyll-sitemap"
data/lib/sitemap.xml CHANGED
@@ -1,9 +1,9 @@
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
- {% capture site_url %}{% if site.url %}{{ site.url }}{% else %}{{ site.github.url }}{% endif %}{% endcapture %}
3
+ {% capture site_url %}{% if site.url %}{{ site.url | append: site.baseurl }}{% else %}{{ site.github.url }}{% endif %}{% endcapture %}
4
4
  {% for post in site.posts %}{% unless post.sitemap == false %}
5
5
  <url>
6
- <loc>{{ site_url }}{{ post.url }}</loc>
6
+ <loc>{{ post.url | prepend: site_url }}</loc>
7
7
  {% if post.last_modified_at %}
8
8
  <lastmod>{{ post.last_modified_at | date_to_xmlschema }}</lastmod>
9
9
  {% else %}
@@ -14,7 +14,7 @@
14
14
  {% endunless %}{% endfor %}
15
15
  {% for post in site.html_pages %}{% unless post.sitemap == false %}
16
16
  <url>
17
- <loc>{{ site_url }}{{ post.url | replace:'index.html','' }}</loc>
17
+ <loc>{{ post.url | replace:'index.html','' | prepend: site_url }}</loc>
18
18
  <lastmod>{{ site.time | date_to_xmlschema }}</lastmod>
19
19
  <changefreq>weekly</changefreq>
20
20
  <priority>{% if post.url == "/" or post.url == "/index.html" %}1.0{% else %}0.7{% endif %}</priority>
@@ -23,7 +23,7 @@
23
23
  {% for collection in site.collections %}{% unless collection.last.output == false %}
24
24
  {% for doc in collection.last.docs %}{% unless doc.sitemap == false %}
25
25
  <url>
26
- <loc>{{ site_url }}{{ doc.url | replace:'index.html','' }}</loc>
26
+ <loc>{{ doc.url | replace:'index.html','' | prepend: site_url }}</loc>
27
27
  <lastmod>{{ site.time | date_to_xmlschema }}</lastmod>
28
28
  <changefreq>weekly</changefreq>
29
29
  <priority>{% if doc.url == "/" or doc.url == "/index.html" %}1.0{% else %}0.7{% endif %}</priority>
@@ -32,7 +32,7 @@
32
32
  {% endunless %}{% endfor %}
33
33
  {% for file in site.html_files %}
34
34
  <url>
35
- <loc>{{ site_url }}{{ file.path }}</loc>
35
+ <loc>{{ file.path | prepend: site_url }}</loc>
36
36
  <lastmod>{{ file.modified_time | date_to_xmlschema }}</lastmod>
37
37
  <priority>0.6</priority>
38
38
  </url>
@@ -1,15 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe(Jekyll::JekyllSitemap) do
4
- let(:config) do
5
- Jekyll.configuration({
4
+ let(:overrides) do
5
+ {
6
6
  "source" => source_dir,
7
7
  "destination" => dest_dir,
8
8
  "url" => "http://example.org",
9
- "collections" => { "my_collection" => { "output" => true },
10
- "other_things" => { "output" => false }
11
- }
12
- })
9
+ "collections" => {
10
+ "my_collection" => { "output" => true },
11
+ "other_things" => { "output" => false }
12
+ }
13
+ }
14
+ end
15
+ let(:config) do
16
+ Jekyll.configuration(overrides)
13
17
  end
14
18
  let(:site) { Jekyll::Site.new(config) }
15
19
  let(:contents) { File.read(dest_dir("sitemap.xml")) }
@@ -84,4 +88,29 @@ describe(Jekyll::JekyllSitemap) do
84
88
  it "correctly formats timestamps of static files" do
85
89
  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}(-|\+)\d{2}:\d{2}<\/lastmod>/
86
90
  end
91
+
92
+ context "with a baseurl" do
93
+ let(:config) do
94
+ Jekyll.configuration(Jekyll::Utils.deep_merge_hashes(overrides, {"baseurl" => "/bass"}))
95
+ end
96
+
97
+ it "correctly adds the baseurl to the static files" do
98
+ expect(contents).to match /<loc>http:\/\/example\.org\/bass\/some-subfolder\/this-is-a-subfile\.html<\/loc>/
99
+ end
100
+
101
+ it "correctly adds the baseurl to the collections" do
102
+ expect(contents).to match /<loc>http:\/\/example\.org\/bass\/my_collection\/test\.html<\/loc>/
103
+ end
104
+
105
+ it "correctly adds the baseurl to the pages" do
106
+ expect(contents).to match /<loc>http:\/\/example\.org\/bass\/<\/loc>/
107
+ expect(contents).to match /<loc>http:\/\/example\.org\/bass\/some-subfolder\/this-is-a-subpage\.html<\/loc>/
108
+ end
109
+
110
+ it "correctly adds the baseurl to the posts" do
111
+ expect(contents).to match /<loc>http:\/\/example\.org\/bass\/2014\/03\/04\/march-the-fourth\.html<\/loc>/
112
+ expect(contents).to match /<loc>http:\/\/example\.org\/bass\/2014\/03\/02\/march-the-second\.html<\/loc>/
113
+ expect(contents).to match /<loc>http:\/\/example\.org\/bass\/2013\/12\/12\/dec-the-second\.html<\/loc>/
114
+ end
115
+ end
87
116
  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.6.3
4
+ version: 0.7.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-11-12 00:00:00.000000000 Z
11
+ date: 2014-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll