bridgetown-feed 3.0.0 → 3.1.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
  SHA256:
3
- metadata.gz: 663c0250112d2f0867a077cecdd9c2a4b01bee052c4a58606d1dca4a0f773903
4
- data.tar.gz: cf0692b787e2ad54da92c691b59740babe091e87160512f8f30545cc620028be
3
+ metadata.gz: 0022d28402f7e79f811a1df43bf7f4c567781e9508d239046e0ae7e80fd9579c
4
+ data.tar.gz: 4aa6a196a889b0481c62341643dab88ae65d269dba1fa24a0f76562b4ab81a13
5
5
  SHA512:
6
- metadata.gz: 8f030483288682b967d6afd8d666c30a2c9bc5ddd5dbca92e30978c8236ab5b4c4267c66cf6a46d2a253d0c572aa07aa498633d6bd2fa52b9e2093dd79827bb8
7
- data.tar.gz: ac41b9e0db35fafabcadeda6ae5cf65fff893c0246aa7db7a1e5dd0ca69ca715a93d7a52619f8d08295ec9a8a9f7533eac39888433e3f47d6c36eeab9021bf69
6
+ metadata.gz: 76df5d22dc22e825d6a6acfd8381c0ea83ca8c7e43f05767720b0334a759f6a367b25838fbb3803a13f3002f909f19801048d11f8b11147577e024c4df1f7436
7
+ data.tar.gz: 034f66ff0399a8ad53035f404734e475760d287deb624203b16386f84a527ea99c798750d57f3b0216a278e574100d04879fda2c46a2fffbe80efd14d09c30ff
data/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  ...
6
6
 
7
+ ## 3.1.0 / 2024-02-01
8
+
9
+ * Add an option to set the post_limit (@jbennett)
10
+
11
+ ## 3.0.0 / 2022-10-08
12
+
13
+ * Upgrade to initializers system in Bridgetown 1.2
14
+
7
15
  ## 2.1.0 / 2021-10-26
8
16
 
9
17
  * Update test suite and ensure generated pages have the right permalink
data/README.md CHANGED
@@ -2,20 +2,34 @@
2
2
 
3
3
  A Bridgetown plugin to generate an Atom (RSS-like) feed of your Bridgetown posts and other collection documents.
4
4
 
5
- ## Installation
5
+ ## Installation for Bridgetown 1.2+
6
6
 
7
7
  Run this command to add this plugin to your site's Gemfile:
8
8
 
9
9
  ```shell
10
- $ bundle add bridgetown-feed -g bridgetown_plugins
10
+ $ bundle add bridgetown-feed
11
11
  ```
12
12
 
13
13
  Or simply add this line to your Gemfile:
14
14
 
15
15
  ```ruby
16
- gem 'bridgetown-feed', group: "bridgetown_plugins"
16
+ gem 'bridgetown-feed'
17
17
  ```
18
18
 
19
+ And then add the initializer to your configuration in `config/initializers.rb`:
20
+
21
+ ```ruby
22
+ Bridgetown.configure do
23
+ # existing config here
24
+
25
+ init :"bridgetown-feed"
26
+ end
27
+ ```
28
+
29
+ (For Bridgetown 1.1 or earlier, [read these instructions](https://github.com/bridgetownrb/bridgetown-feed/tree/v2.1.0).)
30
+
31
+ ## Usage
32
+
19
33
  The plugin exposes a helper tag to expose the appropriate meta tags to support automated discovery of your feed.
20
34
 
21
35
  Simply place `feed_meta` someplace in your layout's `<head>` section to output the necessary metadata.
@@ -30,12 +44,6 @@ Simply place `feed_meta` someplace in your layout's `<head>` section to output t
30
44
  <%= feed_meta %>
31
45
  ```
32
46
 
33
- ### Atom is nice and all, but what about JSON Feed?
34
-
35
- [It's on our roadmap.](https://github.com/bridgetownrb/bridgetown-feed/issues/1) 🙂
36
-
37
- ## Usage
38
-
39
47
  The plugin will automatically generate an Atom feed at `/feed.xml`.
40
48
 
41
49
  ### Optional configuration options
@@ -88,35 +96,35 @@ There are several ways to convey author-specific information. Author information
88
96
 
89
97
  ```yml
90
98
  author:
91
- twitter: MarinaDiamandis
99
+ name: Issac Asimov
92
100
  ```
93
101
 
94
102
  2. An `author` object, in the site's `_data/site_metadata.yml`, e.g.:
95
103
 
96
104
  ```yml
97
105
  author:
98
- twitter: MarinaDiamandis
106
+ name: Issac Asimov
99
107
  ```
100
108
 
101
109
  3. `site.data.authors[author]`, if an author is specified in the document's front matter, and a corresponding key exists in `site.data.authors`. E.g., you have the following in the document's front matter:
102
110
 
103
111
  ```yml
104
- author: marina
112
+ author: iasimov
105
113
  ```
106
114
 
107
115
  And you have the following in `_data/authors.yml`:
108
116
 
109
117
  ```yml
110
- marina:
111
- picture: /img/marina.png
112
- twitter: MarinaDiamandis
118
+ iasimov:
119
+ picture: /images/marina.jpg
120
+ name: Issac Asimov
113
121
 
114
- jared:
115
- picture: /img/jared.png
116
- twitter: jaredcwhite
122
+ jwhite:
123
+ picture: /images/jared.jpg
124
+ name: Jared White
117
125
  ```
118
126
 
119
- In the above example, the author `marina`'s Twitter handle will be resolved to `@MarinaDiamandis`. This allows you to centralize author information in a single `_data/authors` file for site with many authors that require more than just the author's username.
127
+ In the above example, the author `iasimov`'s name will be resolved to `Issac Asimov`. This allows you to centralize author information in a single `_data/authors.yml` file for site with many authors that require more than just the author's username.
120
128
 
121
129
  *Pro-tip: If `authors` is present in the document's front matter as an array (and `author` is not), the plugin will use the first author listed.*
122
130
 
@@ -132,6 +140,8 @@ There are several ways to convey author-specific information. Author information
132
140
  author: marina
133
141
  ```
134
142
 
143
+ The author keys the plugin can read are `name`, `email`, and `uri` (for linking to an author's website).
144
+
135
145
  ### SmartyPants
136
146
 
137
147
  The plugin uses [Bridgetown's `smartify` filter](https://www.bridgetownrb.com/docs/liquid/filters) for processing the site title and post titles. This will translate plain ASCII punctuation into "smart" typographic punctuation. This will not render or strip any Markdown you may be using in a title.
@@ -204,6 +214,26 @@ feed:
204
214
  The same flag can be used directly in post file. It will be disable `<content>` tag for selected post.
205
215
  Settings in post file has higher priority than in config file.
206
216
 
217
+ ## Post Limit
218
+
219
+ Optional flag `post_limit` allows you to set a limit to the number of posts shown in the feed. Default value is `10`.
220
+
221
+ When it is set in `bridgetown.config.yml`, all collections will be limited:
222
+
223
+ ```yml
224
+ feed:
225
+ post_limit: 25
226
+ ```
227
+
228
+ The same flag can also be set on a collection:
229
+
230
+ ```yml
231
+ feed:
232
+ collections:
233
+ changes:
234
+ post_limit: 25
235
+ ```
236
+
207
237
  ## Testing
208
238
 
209
239
  * Run `bundle exec rspec` to run the test suite
@@ -44,7 +44,9 @@
44
44
  {% if page.category %}
45
45
  {% assign posts = posts | where: "category",page.category %}
46
46
  {% endif %}
47
- {% for post in posts limit: 10 %}
47
+ {% assign post_limit = site.feed.collections[page.collection].post_limit | default: site.feed.post_limit | default: 10 %}
48
+ {% assign post_limit = site.feed.collections[page.collection].post_limit | default: site.feed.post_limit %}
49
+ {% for post in posts limit: post_limit %}
48
50
  <entry{% if post.lang %}{{" "}}xml:lang="{{ post.lang }}"{% endif %}>
49
51
  <title type="html">{{ post.title | smartify | strip_html | normalize_whitespace | xml_escape }}</title>
50
52
  <link href="{{ post.absolute_url | default: post.url | absolute_url }}" rel="alternate" type="text/html" title="{{ post.title | xml_escape }}" />
@@ -52,7 +52,7 @@ module BridgetownFeed
52
52
  def collections
53
53
  return @collections if defined?(@collections)
54
54
 
55
- @collections = if config["collections"].is_a?(Array) # rubocop:disable Style/CaseLikeIf
55
+ @collections = if config["collections"].is_a?(Array)
56
56
  config["collections"].map { |c| [c, {}] }.to_h
57
57
  elsif config["collections"].is_a?(Hash)
58
58
  config["collections"]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bridgetown
4
4
  module Feed
5
- VERSION = "3.0.0"
5
+ VERSION = "3.1.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-feed
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-09 00:00:00.000000000 Z
11
+ date: 2024-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bridgetown
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  - !ruby/object:Gem::Version
174
174
  version: '0'
175
175
  requirements: []
176
- rubygems_version: 3.3.3
176
+ rubygems_version: 3.5.3
177
177
  signing_key:
178
178
  specification_version: 4
179
179
  summary: A Bridgetown plugin to generate an Atom feed of your Bridgetown posts