jekyll-feed 0.11.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/History.markdown +49 -2
  3. data/README.md +63 -1
  4. data/lib/jekyll-feed/feed.xml +25 -6
  5. data/lib/jekyll-feed/generator.rb +32 -3
  6. data/lib/jekyll-feed/meta-tag.rb +1 -1
  7. data/lib/jekyll-feed/version.rb +1 -1
  8. metadata +30 -72
  9. data/.gitignore +0 -20
  10. data/.rspec +0 -2
  11. data/.rubocop.yml +0 -28
  12. data/.travis.yml +0 -25
  13. data/Gemfile +0 -8
  14. data/Rakefile +0 -8
  15. data/jekyll-feed.gemspec +0 -30
  16. data/script/bootstrap +0 -3
  17. data/script/cibuild +0 -7
  18. data/script/fmt +0 -10
  19. data/script/release +0 -7
  20. data/script/test +0 -4
  21. data/spec/fixtures/_collection/2018-01-01-collection-doc.md +0 -4
  22. data/spec/fixtures/_collection/2018-01-02-collection-category-doc.md +0 -5
  23. data/spec/fixtures/_config.yml +0 -9
  24. data/spec/fixtures/_data/authors.yml +0 -5
  25. data/spec/fixtures/_drafts/2015-01-12-a-draft.md +0 -4
  26. data/spec/fixtures/_layouts/some_default.html +0 -11
  27. data/spec/fixtures/_posts/2013-12-12-dec-the-second.md +0 -7
  28. data/spec/fixtures/_posts/2014-03-02-march-the-second.md +0 -6
  29. data/spec/fixtures/_posts/2014-03-04-march-the-fourth.md +0 -9
  30. data/spec/fixtures/_posts/2015-01-18-jekyll-last-modified-at.md +0 -5
  31. data/spec/fixtures/_posts/2015-02-12-strip-newlines.md +0 -6
  32. data/spec/fixtures/_posts/2015-05-12-liquid.md +0 -7
  33. data/spec/fixtures/_posts/2015-05-12-pre.html +0 -8
  34. data/spec/fixtures/_posts/2015-05-18-author-detail.md +0 -9
  35. data/spec/fixtures/_posts/2015-08-08-stuck-in-the-middle.html +0 -2
  36. data/spec/fixtures/_posts/2016-04-25-author-reference.md +0 -6
  37. data/spec/fixtures/feed.xslt.xml +0 -0
  38. data/spec/jekyll-feed_spec.rb +0 -474
  39. data/spec/spec_helper.rb +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2f39a0bbb0b44fe86056121002e483fdad9fd750d80df250c3bb8d2773deb62
4
- data.tar.gz: 5b8873c7d89f01de3ab5d87c02a30b0186153d1f6c0b05812f8f428b83bfb54a
3
+ metadata.gz: 9c16a6de621d9c8d90b53acc943396557d63fb1b15a4cc31b749a8b955baf8dd
4
+ data.tar.gz: 9e913f474172053d3c89bc6de8c042a8649b33b1dd0d5004a8905eec4ad4e3a2
5
5
  SHA512:
6
- metadata.gz: 0dcd26441f769bef785939357a38cf4b7f299f10bd273553b2f0ee2aa1fde50b1664c94fbac3534bb14b3f8cb8e36e5f361b21e339a8b8e140f6ba3c839e68f6
7
- data.tar.gz: 9f682591707af1c16b6756e1638acadaa1cd19ac141f3b816dcf3129cea5ef661fa9e6fe0b7a05a6c6000e07d7a147c89ba155e1932f1062211bbabc2e4f27c2
6
+ metadata.gz: 553da9fe75950364d829b66a32e5db1018d9176ea490b70492e92ceff35a466dcfeb022341eac325c0e3517a54f598f5a29a1069a9ba038c59572e608f44ef0c
7
+ data.tar.gz: e37a5317f022496e92ec688a4558a8c1761436b5d72fd8ea6f6aea22f53baa88b4653fb0ae7f37a582a1224ba6504cfd320a4cf1ab0e090fffe43bd99344716d
@@ -1,6 +1,53 @@
1
- ## HEAD
1
+ ## 0.15.0 / 2020-07-10
2
2
 
3
- * Release 💎 0.11 (#241)
3
+ ### Minor Enhancements
4
+
5
+ * Add support for drafts (#316)
6
+
7
+ ## 0.14.0 / 2020-06-24
8
+
9
+ ### Minor Enhancements
10
+
11
+ * add support for categories (#153) (#233)
12
+ * add support for tags (#264)
13
+ * Make posts limit configurable (#314)
14
+ * XML escape the title field of feed_meta (#306)
15
+
16
+ ### Bug Fixes
17
+
18
+ * Fix feed link when post title contains HTML (#305)
19
+
20
+ ### Development Fixes
21
+
22
+ * Use Dir to list source files (#309)
23
+ * Require Ruby >=2.4.0 (#307)
24
+
25
+ ## 0.13.0 / 2019-11-13
26
+
27
+ ### Minor Enhancements
28
+
29
+ * Excerpt only flag (#287)
30
+ * Add media:content tag (#290)
31
+
32
+ ### Development Fixes
33
+
34
+ * test: use categories in post (#249)
35
+
36
+ ## 0.12.1 / 2019-03-23
37
+
38
+ ### Bug Fixes
39
+
40
+ * Re-introduce Ruby 2.3 support and test Jekyll 3.7+ (#272)
41
+
42
+ ## 0.12.0 / 2019-03-21
43
+
44
+ * Allow Jekyll v4 (still alpha)
45
+
46
+ ### Development Fixes
47
+
48
+ * style: fix offenses in specs (#248)
49
+ * dev: update CI and style settings (#258)
50
+ * Enable testing for Windows platform (#265)
4
51
 
5
52
  ## 0.11.0 / 2018-09-09
6
53
 
data/README.md CHANGED
@@ -31,7 +31,7 @@ The plugin will automatically use any of the following configuration variables,
31
31
 
32
32
  * `title` or `name` - The title of the site, e.g., "My awesome site"
33
33
  * `description` - A longer description of what your site is about, e.g., "Where I blog about Jekyll and other awesome things"
34
- * `url` - The URL to your site, e.g., `http://example.com`. If none is provided, the plugin will try to use `site.github.url`.
34
+ * `url` - The URL to your site, e.g., `https://example.com`. If none is provided, the plugin will try to use `site.github.url`.
35
35
  * `author` - Global author information (see below)
36
36
 
37
37
  ### Already have a feed path?
@@ -151,6 +151,15 @@ feed:
151
151
  - updates
152
152
  ```
153
153
 
154
+ ## Posts limit
155
+
156
+ By default the plugin limits the number of posts in the feed to 10. Simply define a new limit in your config:
157
+
158
+ ```yml
159
+ feed:
160
+ posts_limit: 20
161
+ ```
162
+
154
163
  ## Collections
155
164
 
156
165
  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:
@@ -182,6 +191,59 @@ feed:
182
191
  - updates
183
192
  ```
184
193
 
194
+ ## Excerpt Only flag
195
+
196
+ Optional flag `excerpt_only` allows you to exclude post content from the Atom feed. Default value is `false` for backward compatibility.
197
+
198
+ When in `config.yml` is `true` than all posts in feed will be without `<content>` tags.
199
+
200
+ ```yml
201
+ feed:
202
+ excerpt_only: true
203
+ ```
204
+
205
+ The same flag can be used directly in post file. It will be disable `<content>` tag for selected post.
206
+ Settings in post file has higher priority than in config file.
207
+
208
+ ## Tags
209
+
210
+ To automatically generate feeds for each tag you apply to your posts you can add a tags setting to your config:
211
+
212
+ ```yml
213
+ feed:
214
+ tags: true
215
+ ```
216
+
217
+ If there are tags you don't want included in this auto generation you can exclude them
218
+
219
+ ```yml
220
+ feed:
221
+ tags:
222
+ except:
223
+ - tag-to-exclude
224
+ - another-tag
225
+ ```
226
+
227
+ If you wish to change the location of these auto generated feeds (`/feed/by_tag/<TAG>.xml` by default) you can provide an alternative folder for them to live in.
228
+
229
+ ```yml
230
+ feed:
231
+ tags:
232
+ path: "alternative/path/for/tags/feeds/"
233
+ ```
234
+
235
+ If you only want to generate feeds for a few tags you can also set this.
236
+
237
+ ```yml
238
+ feed:
239
+ tags:
240
+ only:
241
+ - tag-to-include
242
+ - another-tag
243
+ ```
244
+
245
+ Note that if you include a tag that is excluded a feed will not be generated for it.
246
+
185
247
  ## Contributing
186
248
 
187
249
  1. Fork it (https://github.com/jekyll/jekyll-feed/fork)
@@ -39,18 +39,32 @@
39
39
  </author>
40
40
  {% endif %}
41
41
 
42
- {% assign posts = site[page.collection] | where_exp: "post", "post.draft != true" | sort: "date" | reverse %}
42
+ {% if page.tags %}
43
+ {% assign posts = site.tags[page.tags] %}
44
+ {% else %}
45
+ {% assign posts = site[page.collection] %}
46
+ {% endif %}
43
47
  {% if page.category %}
44
- {% assign posts = posts | where: "category",page.category %}
48
+ {% assign posts = posts | where: "category", page.category %}
45
49
  {% endif %}
46
- {% for post in posts limit: 10 %}
50
+ {% unless site.show_drafts %}
51
+ {% assign posts = posts | where_exp: "post", "post.draft != true" %}
52
+ {% endunless %}
53
+ {% assign posts = posts | sort: "date" | reverse %}
54
+ {% assign posts_limit = site.feed.posts_limit | default: 10 %}
55
+ {% for post in posts limit: posts_limit %}
47
56
  <entry{% if post.lang %}{{" "}}xml:lang="{{ post.lang }}"{% endif %}>
48
- <title type="html">{{ post.title | smartify | strip_html | normalize_whitespace | xml_escape }}</title>
49
- <link href="{{ post.url | absolute_url }}" rel="alternate" type="text/html" title="{{ post.title | xml_escape }}" />
57
+ {% assign post_title = post.title | smartify | strip_html | normalize_whitespace | xml_escape %}
58
+
59
+ <title type="html">{{ post_title }}</title>
60
+ <link href="{{ post.url | absolute_url }}" rel="alternate" type="text/html" title="{{ post_title }}" />
50
61
  <published>{{ post.date | date_to_xmlschema }}</published>
51
62
  <updated>{{ post.last_modified_at | default: post.date | date_to_xmlschema }}</updated>
52
63
  <id>{{ post.id | absolute_url | xml_escape }}</id>
53
- <content type="html" xml:base="{{ post.url | absolute_url | xml_escape }}">{{ post.content | strip | xml_escape }}</content>
64
+ {% assign excerpt_only = post.feed.excerpt_only | default: site.feed.excerpt_only %}
65
+ {% unless excerpt_only %}
66
+ <content type="html" xml:base="{{ post.url | absolute_url | xml_escape }}">{{ post.content | strip | xml_escape }}</content>
67
+ {% endunless %}
54
68
 
55
69
  {% assign post_author = post.author | default: post.authors[0] | default: site.author %}
56
70
  {% assign post_author = site.data.authors[post_author] | default: post_author %}
@@ -70,6 +84,10 @@
70
84
 
71
85
  {% if post.category %}
72
86
  <category term="{{ post.category | xml_escape }}" />
87
+ {% elsif post.categories %}
88
+ {% for category in post.categories %}
89
+ <category term="{{ category | xml_escape }}" />
90
+ {% endfor %}
73
91
  {% endif %}
74
92
 
75
93
  {% for tag in post.tags %}
@@ -86,6 +104,7 @@
86
104
  {% assign post_image = post_image | absolute_url %}
87
105
  {% endunless %}
88
106
  <media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="{{ post_image | xml_escape }}" />
107
+ <media:content medium="image" url="{{ post_image | xml_escape }}" xmlns:media="http://search.yahoo.com/mrss/" />
89
108
  {% endif %}
90
109
  </entry>
91
110
  {% endfor %}
@@ -13,9 +13,11 @@ module JekyllFeed
13
13
  (meta["categories"] + [nil]).each do |category|
14
14
  path = feed_path(:collection => name, :category => category)
15
15
  next if file_exists?(path)
16
+
16
17
  @site.pages << make_page(path, :collection => name, :category => category)
17
18
  end
18
19
  end
20
+ generate_feed_by_tag if config["tags"] && !@site.tags.empty?
19
21
  end
20
22
 
21
23
  private
@@ -24,7 +26,7 @@ module JekyllFeed
24
26
  # 1. A '>', which closes an XML tag or
25
27
  # 2. A '}', which closes a Liquid tag
26
28
  # We will strip all of this whitespace to minify the template
27
- MINIFY_REGEX = %r!(?<=>|})\s+!
29
+ MINIFY_REGEX = %r!(?<=>|})\s+!.freeze
28
30
 
29
31
  # Returns the plugin's config or an empty hash if not set
30
32
  def config
@@ -68,6 +70,32 @@ module JekyllFeed
68
70
  @collections
69
71
  end
70
72
 
73
+ def generate_feed_by_tag
74
+ tags_config = config["tags"]
75
+ tags_config = {} unless tags_config.is_a?(Hash)
76
+
77
+ except = tags_config["except"] || []
78
+ only = tags_config["only"] || @site.tags.keys
79
+ tags_pool = only - except
80
+ tags_path = tags_config["path"] || "/feed/by_tag/"
81
+
82
+ generate_tag_feed(tags_pool, tags_path)
83
+ end
84
+
85
+ def generate_tag_feed(tags_pool, tags_path)
86
+ tags_pool.each do |tag|
87
+ # allow only tags with basic alphanumeric characters and underscore to keep
88
+ # feed path simple.
89
+ next if %r![^a-zA-Z0-9_]!.match?(tag)
90
+
91
+ Jekyll.logger.info "Jekyll Feed:", "Generating feed for posts tagged #{tag}"
92
+ path = "#{tags_path}#{tag}.xml"
93
+ next if file_exists?(path)
94
+
95
+ @site.pages << make_page(path, :tags => tag)
96
+ end
97
+ end
98
+
71
99
  # Path to feed.xml template file
72
100
  def feed_source_path
73
101
  @feed_source_path ||= File.expand_path "feed.xml", __dir__
@@ -84,7 +112,7 @@ module JekyllFeed
84
112
 
85
113
  # Generates contents for a file
86
114
 
87
- def make_page(file_path, collection: "posts", category: nil)
115
+ def make_page(file_path, collection: "posts", category: nil, tags: nil)
88
116
  PageWithoutAFile.new(@site, __dir__, "", file_path).tap do |file|
89
117
  file.content = feed_template
90
118
  file.data.merge!(
@@ -92,7 +120,8 @@ module JekyllFeed
92
120
  "sitemap" => false,
93
121
  "xsl" => file_exists?("feed.xslt.xml"),
94
122
  "collection" => collection,
95
- "category" => category
123
+ "category" => category,
124
+ "tags" => tags
96
125
  )
97
126
  file.output
98
127
  end
@@ -7,7 +7,7 @@ module JekyllFeed
7
7
 
8
8
  def render(context)
9
9
  @context = context
10
- attrs = attributes.map { |k, v| %(#{k}="#{v}") }.join(" ")
10
+ attrs = attributes.map { |k, v| %(#{k}=#{v.encode(:xml => :attr)}) }.join(" ")
11
11
  "<link #{attrs} />"
12
12
  end
13
13
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Feed
5
- VERSION = "0.11.0"
5
+ VERSION = "0.15.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,43 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-feed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-09 00:00:00.000000000 Z
11
+ date: 2020-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.7'
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '3.3'
22
+ version: '5.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.7'
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '3.3'
32
+ version: '5.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - "~>"
37
+ - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: '1.15'
39
+ version: '0'
34
40
  type: :development
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - "~>"
44
+ - - ">="
39
45
  - !ruby/object:Gem::Version
40
- version: '1.15'
46
+ version: '0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: nokogiri
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -81,19 +87,19 @@ dependencies:
81
87
  - !ruby/object:Gem::Version
82
88
  version: '3.0'
83
89
  - !ruby/object:Gem::Dependency
84
- name: rubocop
90
+ name: rubocop-jekyll
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - "~>"
88
94
  - !ruby/object:Gem::Version
89
- version: 0.57.2
95
+ version: '0.5'
90
96
  type: :development
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
100
  - - "~>"
95
101
  - !ruby/object:Gem::Version
96
- version: 0.57.2
102
+ version: '0.5'
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: typhoeus
99
105
  requirement: !ruby/object:Gem::Requirement
@@ -114,58 +120,30 @@ dependencies:
114
120
  - - "<"
115
121
  - !ruby/object:Gem::Version
116
122
  version: '2.0'
117
- description:
123
+ description:
118
124
  email:
119
125
  - ben.balter@github.com
120
126
  executables: []
121
127
  extensions: []
122
- extra_rdoc_files: []
128
+ extra_rdoc_files:
129
+ - README.md
130
+ - History.markdown
131
+ - LICENSE.txt
123
132
  files:
124
- - ".gitignore"
125
- - ".rspec"
126
- - ".rubocop.yml"
127
- - ".travis.yml"
128
- - Gemfile
129
133
  - History.markdown
130
134
  - LICENSE.txt
131
135
  - README.md
132
- - Rakefile
133
- - jekyll-feed.gemspec
134
136
  - lib/jekyll-feed.rb
135
137
  - lib/jekyll-feed/feed.xml
136
138
  - lib/jekyll-feed/generator.rb
137
139
  - lib/jekyll-feed/meta-tag.rb
138
140
  - lib/jekyll-feed/page-without-a-file.rb
139
141
  - lib/jekyll-feed/version.rb
140
- - script/bootstrap
141
- - script/cibuild
142
- - script/fmt
143
- - script/release
144
- - script/test
145
- - spec/fixtures/_collection/2018-01-01-collection-doc.md
146
- - spec/fixtures/_collection/2018-01-02-collection-category-doc.md
147
- - spec/fixtures/_config.yml
148
- - spec/fixtures/_data/authors.yml
149
- - spec/fixtures/_drafts/2015-01-12-a-draft.md
150
- - spec/fixtures/_layouts/some_default.html
151
- - spec/fixtures/_posts/2013-12-12-dec-the-second.md
152
- - spec/fixtures/_posts/2014-03-02-march-the-second.md
153
- - spec/fixtures/_posts/2014-03-04-march-the-fourth.md
154
- - spec/fixtures/_posts/2015-01-18-jekyll-last-modified-at.md
155
- - spec/fixtures/_posts/2015-02-12-strip-newlines.md
156
- - spec/fixtures/_posts/2015-05-12-liquid.md
157
- - spec/fixtures/_posts/2015-05-12-pre.html
158
- - spec/fixtures/_posts/2015-05-18-author-detail.md
159
- - spec/fixtures/_posts/2015-08-08-stuck-in-the-middle.html
160
- - spec/fixtures/_posts/2016-04-25-author-reference.md
161
- - spec/fixtures/feed.xslt.xml
162
- - spec/jekyll-feed_spec.rb
163
- - spec/spec_helper.rb
164
142
  homepage: https://github.com/jekyll/jekyll-feed
165
143
  licenses:
166
144
  - MIT
167
145
  metadata: {}
168
- post_install_message:
146
+ post_install_message:
169
147
  rdoc_options: []
170
148
  require_paths:
171
149
  - lib
@@ -173,35 +151,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
151
  requirements:
174
152
  - - ">="
175
153
  - !ruby/object:Gem::Version
176
- version: 2.3.0
154
+ version: 2.4.0
177
155
  required_rubygems_version: !ruby/object:Gem::Requirement
178
156
  requirements:
179
157
  - - ">="
180
158
  - !ruby/object:Gem::Version
181
159
  version: '0'
182
160
  requirements: []
183
- rubyforge_project:
184
- rubygems_version: 2.7.7
185
- signing_key:
161
+ rubygems_version: 3.1.2
162
+ signing_key:
186
163
  specification_version: 4
187
164
  summary: A Jekyll plugin to generate an Atom feed of your Jekyll posts
188
- test_files:
189
- - spec/fixtures/_collection/2018-01-01-collection-doc.md
190
- - spec/fixtures/_collection/2018-01-02-collection-category-doc.md
191
- - spec/fixtures/_config.yml
192
- - spec/fixtures/_data/authors.yml
193
- - spec/fixtures/_drafts/2015-01-12-a-draft.md
194
- - spec/fixtures/_layouts/some_default.html
195
- - spec/fixtures/_posts/2013-12-12-dec-the-second.md
196
- - spec/fixtures/_posts/2014-03-02-march-the-second.md
197
- - spec/fixtures/_posts/2014-03-04-march-the-fourth.md
198
- - spec/fixtures/_posts/2015-01-18-jekyll-last-modified-at.md
199
- - spec/fixtures/_posts/2015-02-12-strip-newlines.md
200
- - spec/fixtures/_posts/2015-05-12-liquid.md
201
- - spec/fixtures/_posts/2015-05-12-pre.html
202
- - spec/fixtures/_posts/2015-05-18-author-detail.md
203
- - spec/fixtures/_posts/2015-08-08-stuck-in-the-middle.html
204
- - spec/fixtures/_posts/2016-04-25-author-reference.md
205
- - spec/fixtures/feed.xslt.xml
206
- - spec/jekyll-feed_spec.rb
207
- - spec/spec_helper.rb
165
+ test_files: []