jekyll-feed 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/History.markdown +16 -0
- data/README.md +42 -0
- data/jekyll-feed.gemspec +3 -2
- data/lib/jekyll-feed/feed.xml +17 -6
- data/lib/jekyll-feed/generator.rb +76 -22
- data/lib/jekyll-feed/meta-tag.rb +2 -6
- data/lib/jekyll-feed/version.rb +1 -1
- data/spec/fixtures/_collection/2018-01-01-collection-doc.md +4 -0
- data/spec/fixtures/_collection/2018-01-02-collection-category-doc.md +5 -0
- data/spec/fixtures/_posts/2013-12-12-dec-the-second.md +1 -0
- data/spec/fixtures/_posts/2014-03-02-march-the-second.md +1 -0
- data/spec/fixtures/_posts/2014-03-04-march-the-fourth.md +1 -0
- data/spec/jekyll-feed_spec.rb +168 -7
- metadata +12 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a2f39a0bbb0b44fe86056121002e483fdad9fd750d80df250c3bb8d2773deb62
|
4
|
+
data.tar.gz: 5b8873c7d89f01de3ab5d87c02a30b0186153d1f6c0b05812f8f428b83bfb54a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dcd26441f769bef785939357a38cf4b7f299f10bd273553b2f0ee2aa1fde50b1664c94fbac3534bb14b3f8cb8e36e5f361b21e339a8b8e140f6ba3c839e68f6
|
7
|
+
data.tar.gz: 9f682591707af1c16b6756e1638acadaa1cd19ac141f3b816dcf3129cea5ef661fa9e6fe0b7a05a6c6000e07d7a147c89ba155e1932f1062211bbabc2e4f27c2
|
data/History.markdown
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## HEAD
|
2
|
+
|
3
|
+
* Release 💎 0.11 (#241)
|
4
|
+
|
5
|
+
## 0.11.0 / 2018-09-09
|
6
|
+
|
7
|
+
### Development Fixes
|
8
|
+
|
9
|
+
* Require Ruby 2.3 (#222)
|
10
|
+
* Refactor to remove redundant calls and variables (#240)
|
11
|
+
|
12
|
+
### Minor Enhancements
|
13
|
+
|
14
|
+
* Categories and collections (#228)
|
15
|
+
* Remove check for older version of Jekyll (#234)
|
16
|
+
|
1
17
|
## 0.10.0 / 2018-06-04
|
2
18
|
|
3
19
|
### Bug Fixes
|
data/README.md
CHANGED
@@ -140,6 +140,48 @@ Want to style what your feed looks like in the browser? Simply add an XSLT at `/
|
|
140
140
|
|
141
141
|
Great question. In short, Atom is a better format. Think of it like RSS 3.0. For more information, see [this discussion on why we chose Atom over RSS 2.0](https://github.com/jekyll/jekyll-rss-feed/issues/2).
|
142
142
|
|
143
|
+
## Categories
|
144
|
+
|
145
|
+
Jekyll Feed can generate feeds for each category. Simply define which categories you'd like feeds for in your config:
|
146
|
+
|
147
|
+
```yml
|
148
|
+
feed:
|
149
|
+
categories:
|
150
|
+
- news
|
151
|
+
- updates
|
152
|
+
```
|
153
|
+
|
154
|
+
## Collections
|
155
|
+
|
156
|
+
Jekyll Feed can generate feeds for collections other than the Posts collection. This works best for chronological collections (e.g., collections with dates in the filenames). Simply define which collections you'd like feeds for in your config:
|
157
|
+
|
158
|
+
```yml
|
159
|
+
feed:
|
160
|
+
collections:
|
161
|
+
- changes
|
162
|
+
```
|
163
|
+
|
164
|
+
By default, collection feeds will be outputted to `/feed/<COLLECTION>.xml`. If you'd like to customize the output path, specify a collection's custom path as follows:
|
165
|
+
|
166
|
+
```yml
|
167
|
+
feed:
|
168
|
+
collections:
|
169
|
+
changes:
|
170
|
+
path: "/changes.xml"
|
171
|
+
```
|
172
|
+
|
173
|
+
Finally, collections can also have category feeds which are outputted as `/feed/<COLLECTION>/<CATEGORY>.xml`. Specify categories like so:
|
174
|
+
|
175
|
+
```yml
|
176
|
+
feed:
|
177
|
+
collections:
|
178
|
+
changes:
|
179
|
+
path: "/changes.xml"
|
180
|
+
categories:
|
181
|
+
- news
|
182
|
+
- updates
|
183
|
+
```
|
184
|
+
|
143
185
|
## Contributing
|
144
186
|
|
145
187
|
1. Fork it (https://github.com/jekyll/jekyll-feed/fork)
|
data/jekyll-feed.gemspec
CHANGED
@@ -18,12 +18,13 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r!^(test|spec|features)/!)
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.
|
21
|
+
spec.required_ruby_version = ">= 2.3.0"
|
22
22
|
|
23
|
+
spec.add_dependency "jekyll", "~> 3.3"
|
23
24
|
spec.add_development_dependency "bundler", "~> 1.15"
|
24
25
|
spec.add_development_dependency "nokogiri", "~> 1.6"
|
25
26
|
spec.add_development_dependency "rake", "~> 12.0"
|
26
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
-
spec.add_development_dependency "rubocop", "0.
|
28
|
+
spec.add_development_dependency "rubocop", "~> 0.57.2"
|
28
29
|
spec.add_development_dependency "typhoeus", ">= 0.7", "< 2.0"
|
29
30
|
end
|
data/lib/jekyll-feed/feed.xml
CHANGED
@@ -7,12 +7,20 @@
|
|
7
7
|
<link href="{{ page.url | absolute_url }}" rel="self" type="application/atom+xml" />
|
8
8
|
<link href="{{ '/' | absolute_url }}" rel="alternate" type="text/html" {% if site.lang %}hreflang="{{ site.lang }}" {% endif %}/>
|
9
9
|
<updated>{{ site.time | date_to_xmlschema }}</updated>
|
10
|
-
<id>{{
|
10
|
+
<id>{{ page.url | absolute_url | xml_escape }}</id>
|
11
11
|
|
12
|
-
{%
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
{% assign title = site.title | default: site.name %}
|
13
|
+
{% if page.collection != "posts" %}
|
14
|
+
{% assign collection = page.collection | capitalize %}
|
15
|
+
{% assign title = title | append: " | " | append: collection %}
|
16
|
+
{% endif %}
|
17
|
+
{% if page.category %}
|
18
|
+
{% assign category = page.category | capitalize %}
|
19
|
+
{% assign title = title | append: " | " | append: category %}
|
20
|
+
{% endif %}
|
21
|
+
|
22
|
+
{% if title %}
|
23
|
+
<title type="html">{{ title | smartify | xml_escape }}</title>
|
16
24
|
{% endif %}
|
17
25
|
|
18
26
|
{% if site.description %}
|
@@ -31,7 +39,10 @@
|
|
31
39
|
</author>
|
32
40
|
{% endif %}
|
33
41
|
|
34
|
-
{% assign posts = site.
|
42
|
+
{% assign posts = site[page.collection] | where_exp: "post", "post.draft != true" | sort: "date" | reverse %}
|
43
|
+
{% if page.category %}
|
44
|
+
{% assign posts = posts | where: "category",page.category %}
|
45
|
+
{% endif %}
|
35
46
|
{% for post in posts limit: 10 %}
|
36
47
|
<entry{% if post.lang %}{{" "}}xml:lang="{{ post.lang }}"{% endif %}>
|
37
48
|
<title type="html">{{ post.title | smartify | strip_html | normalize_whitespace | xml_escape }}</title>
|
@@ -8,8 +8,14 @@ module JekyllFeed
|
|
8
8
|
# Main plugin action, called by Jekyll-core
|
9
9
|
def generate(site)
|
10
10
|
@site = site
|
11
|
-
|
12
|
-
|
11
|
+
collections.each do |name, meta|
|
12
|
+
Jekyll.logger.info "Jekyll Feed:", "Generating feed for #{name}"
|
13
|
+
(meta["categories"] + [nil]).each do |category|
|
14
|
+
path = feed_path(:collection => name, :category => category)
|
15
|
+
next if file_exists?(path)
|
16
|
+
@site.pages << make_page(path, :collection => name, :category => category)
|
17
|
+
end
|
18
|
+
end
|
13
19
|
end
|
14
20
|
|
15
21
|
private
|
@@ -20,38 +26,86 @@ module JekyllFeed
|
|
20
26
|
# We will strip all of this whitespace to minify the template
|
21
27
|
MINIFY_REGEX = %r!(?<=>|})\s+!
|
22
28
|
|
23
|
-
#
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
+
# Returns the plugin's config or an empty hash if not set
|
30
|
+
def config
|
31
|
+
@config ||= @site.config["feed"] || {}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Determines the destination path of a given feed
|
35
|
+
#
|
36
|
+
# collection - the name of a collection, e.g., "posts"
|
37
|
+
# category - a category within that collection, e.g., "news"
|
38
|
+
#
|
39
|
+
# Will return "/feed.xml", or the config-specified default feed for posts
|
40
|
+
# Will return `/feed/category.xml` for post categories
|
41
|
+
# WIll return `/feed/collection.xml` for other collections
|
42
|
+
# Will return `/feed/collection/category.xml` for other collection categories
|
43
|
+
def feed_path(collection: "posts", category: nil)
|
44
|
+
prefix = collection == "posts" ? "/feed" : "/feed/#{collection}"
|
45
|
+
return "#{prefix}/#{category}.xml" if category
|
46
|
+
|
47
|
+
collections.dig(collection, "path") || "#{prefix}.xml"
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns a hash representing all collections to be processed and their metadata
|
51
|
+
# in the form of { collection_name => { categories = [...], path = "..." } }
|
52
|
+
def collections
|
53
|
+
return @collections if defined?(@collections)
|
54
|
+
|
55
|
+
@collections = if config["collections"].is_a?(Array)
|
56
|
+
config["collections"].map { |c| [c, {}] }.to_h
|
57
|
+
elsif config["collections"].is_a?(Hash)
|
58
|
+
config["collections"]
|
59
|
+
else
|
60
|
+
{}
|
61
|
+
end
|
62
|
+
|
63
|
+
@collections = normalize_posts_meta(@collections)
|
64
|
+
@collections.each_value do |meta|
|
65
|
+
meta["categories"] = (meta["categories"] || []).to_set
|
29
66
|
end
|
67
|
+
|
68
|
+
@collections
|
30
69
|
end
|
31
70
|
|
32
71
|
# Path to feed.xml template file
|
33
72
|
def feed_source_path
|
34
|
-
File.expand_path "feed.xml", __dir__
|
73
|
+
@feed_source_path ||= File.expand_path "feed.xml", __dir__
|
74
|
+
end
|
75
|
+
|
76
|
+
def feed_template
|
77
|
+
@feed_template ||= File.read(feed_source_path).gsub(MINIFY_REGEX, "")
|
35
78
|
end
|
36
79
|
|
37
80
|
# Checks if a file already exists in the site source
|
38
81
|
def file_exists?(file_path)
|
39
|
-
|
40
|
-
File.exist? @site.in_source_dir(file_path)
|
41
|
-
else
|
42
|
-
File.exist? Jekyll.sanitized_path(@site.source, file_path)
|
43
|
-
end
|
82
|
+
File.exist? @site.in_source_dir(file_path)
|
44
83
|
end
|
45
84
|
|
46
85
|
# Generates contents for a file
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
86
|
+
|
87
|
+
def make_page(file_path, collection: "posts", category: nil)
|
88
|
+
PageWithoutAFile.new(@site, __dir__, "", file_path).tap do |file|
|
89
|
+
file.content = feed_template
|
90
|
+
file.data.merge!(
|
91
|
+
"layout" => nil,
|
92
|
+
"sitemap" => false,
|
93
|
+
"xsl" => file_exists?("feed.xslt.xml"),
|
94
|
+
"collection" => collection,
|
95
|
+
"category" => category
|
96
|
+
)
|
97
|
+
file.output
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# Special case the "posts" collection, which, for ease of use and backwards
|
102
|
+
# compatability, can be configured via top-level keys or directly as a collection
|
103
|
+
def normalize_posts_meta(hash)
|
104
|
+
hash["posts"] ||= {}
|
105
|
+
hash["posts"]["path"] ||= config["path"]
|
106
|
+
hash["posts"]["categories"] ||= config["categories"]
|
107
|
+
config["path"] ||= hash["posts"]["path"]
|
108
|
+
hash
|
55
109
|
end
|
56
110
|
end
|
57
111
|
end
|
data/lib/jekyll-feed/meta-tag.rb
CHANGED
@@ -14,7 +14,7 @@ module JekyllFeed
|
|
14
14
|
private
|
15
15
|
|
16
16
|
def config
|
17
|
-
@context.registers[:site].config
|
17
|
+
@config ||= @context.registers[:site].config
|
18
18
|
end
|
19
19
|
|
20
20
|
def attributes
|
@@ -27,11 +27,7 @@ module JekyllFeed
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def path
|
30
|
-
|
31
|
-
config["feed"]["path"]
|
32
|
-
else
|
33
|
-
"feed.xml"
|
34
|
-
end
|
30
|
+
config.dig("feed", "path") || "feed.xml"
|
35
31
|
end
|
36
32
|
|
37
33
|
def title
|
data/lib/jekyll-feed/version.rb
CHANGED
data/spec/jekyll-feed_spec.rb
CHANGED
@@ -43,9 +43,9 @@ describe(JekyllFeed) do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "puts all the posts in the feed.xml file" do
|
46
|
-
expect(contents).to match /http:\/\/example\.org\/2014\/03\/04\/march-the-fourth\.html/
|
47
|
-
expect(contents).to match /http:\/\/example\.org\/2014\/03\/02\/march-the-second\.html/
|
48
|
-
expect(contents).to match /http:\/\/example\.org\/2013\/12\/12\/dec-the-second\.html/
|
46
|
+
expect(contents).to match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/
|
47
|
+
expect(contents).to match /http:\/\/example\.org\/news\/2014\/03\/02\/march-the-second\.html/
|
48
|
+
expect(contents).to match /http:\/\/example\.org\/news\/2013\/12\/12\/dec-the-second\.html/
|
49
49
|
expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
50
50
|
expect(contents).to_not match /http:\/\/example\.org\/2016\/02\/09\/a-draft\.html/
|
51
51
|
end
|
@@ -125,7 +125,7 @@ describe(JekyllFeed) do
|
|
125
125
|
it "includes item contents" do
|
126
126
|
post = feed.items.last
|
127
127
|
expect(post.title.content).to eql("Dec The Second")
|
128
|
-
expect(post.link.href).to eql("http://example.org/2013/12/12/dec-the-second.html")
|
128
|
+
expect(post.link.href).to eql("http://example.org/news/2013/12/12/dec-the-second.html")
|
129
129
|
expect(post.published.content).to eql(Time.parse("2013-12-12"))
|
130
130
|
end
|
131
131
|
|
@@ -239,9 +239,9 @@ describe(JekyllFeed) do
|
|
239
239
|
end
|
240
240
|
|
241
241
|
it "correctly adds the baseurl to the posts" do
|
242
|
-
expect(contents).to match /http:\/\/example\.org\/bass\/2014\/03\/04\/march-the-fourth\.html/
|
243
|
-
expect(contents).to match /http:\/\/example\.org\/bass\/2014\/03\/02\/march-the-second\.html/
|
244
|
-
expect(contents).to match /http:\/\/example\.org\/bass\/2013\/12\/12\/dec-the-second\.html/
|
242
|
+
expect(contents).to match /http:\/\/example\.org\/bass\/updates\/2014\/03\/04\/march-the-fourth\.html/
|
243
|
+
expect(contents).to match /http:\/\/example\.org\/bass\/news\/2014\/03\/02\/march-the-second\.html/
|
244
|
+
expect(contents).to match /http:\/\/example\.org\/bass\/news\/2013\/12\/12\/dec-the-second\.html/
|
245
245
|
end
|
246
246
|
|
247
247
|
it "renders the feed meta" do
|
@@ -290,6 +290,29 @@ describe(JekyllFeed) do
|
|
290
290
|
end
|
291
291
|
end
|
292
292
|
|
293
|
+
context "changing the file path via collection meta" do
|
294
|
+
let(:overrides) do
|
295
|
+
{
|
296
|
+
"feed" => {
|
297
|
+
"collections" => {
|
298
|
+
"posts" => {
|
299
|
+
"path" => "atom.xml"
|
300
|
+
}
|
301
|
+
}
|
302
|
+
},
|
303
|
+
}
|
304
|
+
end
|
305
|
+
|
306
|
+
it "should write to atom.xml" do
|
307
|
+
expect(Pathname.new(dest_dir("atom.xml"))).to exist
|
308
|
+
end
|
309
|
+
|
310
|
+
it "renders the feed meta with custom feed path" do
|
311
|
+
expected = 'href="http://example.org/atom.xml"'
|
312
|
+
expect(feed_meta).to include(expected)
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
293
316
|
context "feed stylesheet" do
|
294
317
|
it "includes the stylesheet" do
|
295
318
|
expect(contents).to include('<?xml-stylesheet type="text/xml" href="http://example.org/feed.xslt.xml"?>')
|
@@ -310,4 +333,142 @@ describe(JekyllFeed) do
|
|
310
333
|
expect(contents).to match %r!<entry>!
|
311
334
|
end
|
312
335
|
end
|
336
|
+
|
337
|
+
context "categories" do
|
338
|
+
context "with top-level post categories" do
|
339
|
+
let(:overrides) {
|
340
|
+
{
|
341
|
+
"feed" => { "categories" => ["news"] }
|
342
|
+
}
|
343
|
+
}
|
344
|
+
let(:news_feed) { File.read(dest_dir("feed/news.xml")) }
|
345
|
+
|
346
|
+
it "outputs the primary feed" do
|
347
|
+
expect(contents).to match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/
|
348
|
+
expect(contents).to match /http:\/\/example\.org\/news\/2014\/03\/02\/march-the-second\.html/
|
349
|
+
expect(contents).to match /http:\/\/example\.org\/news\/2013\/12\/12\/dec-the-second\.html/
|
350
|
+
expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
351
|
+
expect(contents).to_not match /http:\/\/example\.org\/2016\/02\/09\/a-draft\.html/
|
352
|
+
end
|
353
|
+
|
354
|
+
it "outputs the category feed" do
|
355
|
+
expect(news_feed).to match "<title type=\"html\">My awesome site | News</title>"
|
356
|
+
expect(news_feed).to match /http:\/\/example\.org\/news\/2014\/03\/02\/march-the-second\.html/
|
357
|
+
expect(news_feed).to match /http:\/\/example\.org\/news\/2013\/12\/12\/dec-the-second\.html/
|
358
|
+
expect(news_feed).to_not match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/
|
359
|
+
expect(news_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
context "with collection-level post categories" do
|
364
|
+
let(:overrides) {
|
365
|
+
{
|
366
|
+
"feed" => {
|
367
|
+
"collections" => {
|
368
|
+
"posts" => {
|
369
|
+
"categories" => ["news"]
|
370
|
+
}
|
371
|
+
}
|
372
|
+
}
|
373
|
+
}
|
374
|
+
}
|
375
|
+
let(:news_feed) { File.read(dest_dir("feed/news.xml")) }
|
376
|
+
|
377
|
+
it "outputs the primary feed" do
|
378
|
+
expect(contents).to match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/
|
379
|
+
expect(contents).to match /http:\/\/example\.org\/news\/2014\/03\/02\/march-the-second\.html/
|
380
|
+
expect(contents).to match /http:\/\/example\.org\/news\/2013\/12\/12\/dec-the-second\.html/
|
381
|
+
expect(contents).to match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
382
|
+
expect(contents).to_not match /http:\/\/example\.org\/2016\/02\/09\/a-draft\.html/
|
383
|
+
end
|
384
|
+
|
385
|
+
it "outputs the category feed" do
|
386
|
+
expect(news_feed).to match "<title type=\"html\">My awesome site | News</title>"
|
387
|
+
expect(news_feed).to match /http:\/\/example\.org\/news\/2014\/03\/02\/march-the-second\.html/
|
388
|
+
expect(news_feed).to match /http:\/\/example\.org\/news\/2013\/12\/12\/dec-the-second\.html/
|
389
|
+
expect(news_feed).to_not match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/
|
390
|
+
expect(news_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
395
|
+
context "collections" do
|
396
|
+
let(:collection_feed) { File.read(dest_dir("feed/collection.xml")) }
|
397
|
+
|
398
|
+
context "when initialized as an array" do
|
399
|
+
let(:overrides) {
|
400
|
+
{
|
401
|
+
"collections" => {
|
402
|
+
"collection" => {
|
403
|
+
"output" => true
|
404
|
+
}
|
405
|
+
},
|
406
|
+
"feed" => { "collections" => ["collection"] }
|
407
|
+
}
|
408
|
+
}
|
409
|
+
|
410
|
+
|
411
|
+
it "outputs the collection feed" do
|
412
|
+
expect(collection_feed).to match "<title type=\"html\">My awesome site | Collection</title>"
|
413
|
+
expect(collection_feed).to match "http://example.org/collection/2018-01-01-collection-doc.html"
|
414
|
+
expect(collection_feed).to match "http://example.org/collection/2018-01-02-collection-category-doc.html"
|
415
|
+
expect(collection_feed).to_not match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/
|
416
|
+
expect(collection_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
context "with categories" do
|
421
|
+
let(:overrides) {
|
422
|
+
{
|
423
|
+
"collections" => {
|
424
|
+
"collection" => {
|
425
|
+
"output" => true
|
426
|
+
}
|
427
|
+
},
|
428
|
+
"feed" => {
|
429
|
+
"collections" => {
|
430
|
+
"collection" => {
|
431
|
+
"categories" => ["news"]
|
432
|
+
}
|
433
|
+
}
|
434
|
+
}
|
435
|
+
}
|
436
|
+
}
|
437
|
+
let(:news_feed) { File.read(dest_dir("feed/collection/news.xml")) }
|
438
|
+
|
439
|
+
it "outputs the collection category feed" do
|
440
|
+
expect(news_feed).to match "<title type=\"html\">My awesome site | Collection | News</title>"
|
441
|
+
expect(news_feed).to match "http://example.org/collection/2018-01-02-collection-category-doc.html"
|
442
|
+
expect(news_feed).to_not match "http://example.org/collection/2018-01-01-collection-doc.html"
|
443
|
+
expect(news_feed).to_not match /http:\/\/example\.org\/updates\/2014\/03\/04\/march-the-fourth\.html/
|
444
|
+
expect(news_feed).to_not match "http://example.org/2015/08/08/stuck-in-the-middle.html"
|
445
|
+
end
|
446
|
+
end
|
447
|
+
|
448
|
+
context "with a custom path" do
|
449
|
+
let(:overrides) {
|
450
|
+
{
|
451
|
+
"collections" => {
|
452
|
+
"collection" => {
|
453
|
+
"output" => true
|
454
|
+
}
|
455
|
+
},
|
456
|
+
"feed" => {
|
457
|
+
"collections" => {
|
458
|
+
"collection" => {
|
459
|
+
"categories" => ["news"],
|
460
|
+
"path" => "custom.xml"
|
461
|
+
}
|
462
|
+
}
|
463
|
+
}
|
464
|
+
}
|
465
|
+
}
|
466
|
+
|
467
|
+
it "should write to the custom path" do
|
468
|
+
expect(Pathname.new(dest_dir("custom.xml"))).to exist
|
469
|
+
expect(Pathname.new(dest_dir("feed/collection.xml"))).to_not exist
|
470
|
+
expect(Pathname.new(dest_dir("feed/collection/news.xml"))).to exist
|
471
|
+
end
|
472
|
+
end
|
473
|
+
end
|
313
474
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-feed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.57.2
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 0.57.2
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: typhoeus
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,6 +142,8 @@ files:
|
|
142
142
|
- script/fmt
|
143
143
|
- script/release
|
144
144
|
- script/test
|
145
|
+
- spec/fixtures/_collection/2018-01-01-collection-doc.md
|
146
|
+
- spec/fixtures/_collection/2018-01-02-collection-category-doc.md
|
145
147
|
- spec/fixtures/_config.yml
|
146
148
|
- spec/fixtures/_data/authors.yml
|
147
149
|
- spec/fixtures/_drafts/2015-01-12-a-draft.md
|
@@ -171,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
173
|
requirements:
|
172
174
|
- - ">="
|
173
175
|
- !ruby/object:Gem::Version
|
174
|
-
version:
|
176
|
+
version: 2.3.0
|
175
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
178
|
requirements:
|
177
179
|
- - ">="
|
@@ -179,11 +181,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
181
|
version: '0'
|
180
182
|
requirements: []
|
181
183
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.7.7
|
183
185
|
signing_key:
|
184
186
|
specification_version: 4
|
185
187
|
summary: A Jekyll plugin to generate an Atom feed of your Jekyll posts
|
186
188
|
test_files:
|
189
|
+
- spec/fixtures/_collection/2018-01-01-collection-doc.md
|
190
|
+
- spec/fixtures/_collection/2018-01-02-collection-category-doc.md
|
187
191
|
- spec/fixtures/_config.yml
|
188
192
|
- spec/fixtures/_data/authors.yml
|
189
193
|
- spec/fixtures/_drafts/2015-01-12-a-draft.md
|