octopress-feeds 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +54 -88
- data/assets/config.yml +14 -5
- data/assets/{includes/article-feed.xml → templates/articles.xml} +3 -1
- data/assets/templates/category.xml +9 -0
- data/assets/{includes/link-feed.xml → templates/links.xml} +3 -1
- data/assets/{includes/main-feed.xml → templates/main.xml} +3 -1
- data/lib/octopress-feeds/tags.rb +25 -18
- data/lib/octopress-feeds/version.rb +1 -1
- data/lib/octopress-feeds.rb +57 -53
- metadata +6 -9
- data/assets/pages/articles.xml +0 -5
- data/assets/pages/links.xml +0 -5
- data/assets/pages/main.xml +0 -5
- data/lib/octopress-feeds/config-asset.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f264c935532788b05d291d01c76a1a559c7e0af
|
4
|
+
data.tar.gz: c31b8664e1e0125eb2fdc0e1af7c901859e3f341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 261edcab26afb5fe009409ac3a9fdc89fe255dc290354fd661b01e0095304c021839920be37e15cfbe1fa9df72c23b448faa339e6aeda37556784d0ccd11bd48
|
7
|
+
data.tar.gz: 81d03cff3a35358e3afdfcbc6e98b8bf48d67955e18630c02ffbfac693e700e25465ba9f67653b500999bc5930674155fc7ad5817f5405a6fa664bf51aa90404
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -85,65 +85,9 @@ each language. Your feed urls will be organized by language. For example:
|
|
85
85
|
|
86
86
|
To change the URL for these pages, read the [Feed Permalinks](#feed-permalinks) section below.
|
87
87
|
|
88
|
-
## Customize feeds
|
89
|
-
|
90
|
-
To list detailed information about this plugin, run `$ octopress ink list feeds`. This will output something like this:
|
91
|
-
|
92
|
-
```
|
93
|
-
Plugin: Octopress Feeds - v1.1.5
|
94
|
-
Slug: feeds
|
95
|
-
RSS feeds for Jekyll sites, featuring link-blogging and multilingual support.
|
96
|
-
https://github.com/octopress/feeds
|
97
|
-
=============================================================
|
98
|
-
includes:
|
99
|
-
- article-feed.xml
|
100
|
-
- entry.xml
|
101
|
-
- head.xml
|
102
|
-
- link-feed.xml
|
103
|
-
- main-feed.xml
|
104
|
-
|
105
|
-
pages: urls:
|
106
|
-
- main.xml /feed/
|
107
|
-
- links.xml /feed/links/ # with octopress-linkblog
|
108
|
-
- articles.xml /feed/articles/ # with octopress-linkblog
|
109
|
-
|
110
|
-
config:
|
111
|
-
count: 20
|
112
|
-
excerpts: false # Feed excerpts post content
|
113
|
-
external_links: true # Linkposts should direct visitors to the linked site
|
114
|
-
titles:
|
115
|
-
main-feed: "Posts Feed"
|
116
|
-
article-feed: "Articles-only Feed"
|
117
|
-
link-feed: "Links-only Feed"
|
118
|
-
```
|
119
|
-
|
120
|
-
If you have posts written in English and German, and are using [octopress-multilingual](https://github.com/octopress/multilingual),
|
121
|
-
your permalinks will automatically be name-spaced by language, like this:
|
122
|
-
|
123
|
-
```
|
124
|
-
pages: urls:
|
125
|
-
- main /en/feed/
|
126
|
-
- links /en/feed/links/
|
127
|
-
- articles /en/feed/articles/
|
128
|
-
- main_de /de/feed/
|
129
|
-
- links_de /de/feed/links/
|
130
|
-
- articles_de /de/feed/articles/
|
131
|
-
```
|
132
|
-
|
133
|
-
Octopress Ink can copy all of the plugin's assets to `_plugins/feeds/*` where you can override them with your own modifications. This is
|
134
|
-
only necessary if you want to modify this plugin's behavior.
|
135
|
-
|
136
|
-
```
|
137
|
-
octopress ink copy feeds
|
138
|
-
```
|
139
|
-
|
140
|
-
This will copy the plugin's configuration, pages, and includes from the gem, to your local site. If, for example, you want to change the XML for an entry, you can simply edit the `_plugins/feeds/includes/entry.xml` file.
|
141
|
-
|
142
|
-
If you want to revert to the defaults, simply delete any file you don't care to override from the `_plugins/feeds/` directory.
|
143
|
-
|
144
88
|
## Configuration
|
145
89
|
|
146
|
-
To configure this plugin, first
|
90
|
+
To configure this plugin, first copy the plugin's configuration file to `_plugins/feeds/config.yml` buy running:
|
147
91
|
|
148
92
|
```
|
149
93
|
$ octopress ink copy feeds --config-file
|
@@ -151,51 +95,45 @@ $ octopress ink copy feeds --config-file
|
|
151
95
|
|
152
96
|
This will create a configuration file populated with the defaults for this plugin. Deleting this file will restore the default configuration.
|
153
97
|
|
98
|
+
### Configuration defaults
|
154
99
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
| `linkposts_feed` | Add an additional link-posts-only feed. | false |
|
162
|
-
| `titles` | Set feed titles for main, article, and link feeds. | [see below] |
|
163
|
-
| `permalinks` | Set the permalink for feed pages. | {} |
|
100
|
+
```
|
101
|
+
count: 20 # Maximum number of posts in a feed
|
102
|
+
excerpts: false # Use post excerpts in feeds
|
103
|
+
external_links: true # Linkposts should direct visitors to the linked site
|
104
|
+
category_feeds: false # Add a feed for post categories
|
105
|
+
categories: [] # Only add feeds for these categories. (empty adds feeds for all categories)
|
164
106
|
|
107
|
+
titles:
|
108
|
+
main: site.name - Posts
|
109
|
+
links: site.name - Links-only
|
110
|
+
articles: site.name - Articles-only
|
111
|
+
category: site.name - Posts in category.name
|
112
|
+
|
113
|
+
permalinks:
|
114
|
+
main: /feed/
|
115
|
+
links: /feed/links/
|
116
|
+
articles: /feed/articles/
|
117
|
+
category: /feed/categories/category.name/
|
118
|
+
```
|
165
119
|
|
166
120
|
### Feed titles
|
167
121
|
|
168
122
|
The `titles` configuration allows you to control the title that RSS subscribers see for your feed.
|
169
123
|
|
170
|
-
|
171
|
-
|
172
|
-
main-feed: Posts Feed
|
173
|
-
article-feed: Articles-only Feed
|
174
|
-
link-feed: Links-only Feed
|
175
|
-
```
|
124
|
+
As you'd expect, `site.name` is replaced with the value from your site configuration and `category.name` is replaced with the
|
125
|
+
category for that feed.
|
176
126
|
|
177
127
|
If you want to change the title for other languages you can add a new language localized config file. For example if you have German
|
178
128
|
feeds, you would add a config file at `_plugins/feeds/config_de.yml` and set titles for your German language feeds.
|
179
129
|
|
180
130
|
### Feed permalinks
|
181
131
|
|
182
|
-
You can set the URL for the feed pages by configuring the `
|
183
|
-
|
184
|
-
```yaml
|
185
|
-
permalinks:
|
186
|
-
main: /rss/
|
187
|
-
links: /rss/links/
|
188
|
-
articles: /rss/articles/
|
189
|
-
```
|
132
|
+
You can set the URL for the feed pages by configuring the `permalinks` setting.
|
190
133
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
pages: urls:
|
195
|
-
- main /rss/
|
196
|
-
- links /rss/links/
|
197
|
-
- articles /rss/articles/
|
198
|
-
```
|
134
|
+
If you are running a multilingual site with [octopress-multilingual](https://github.com/octopress/multilingual) permalinks will be
|
135
|
+
prepended with the lanugage code that corresponds with the posts in that feed. So `/feeds/` will become `/en/feeds/` and `/de/feeds/`
|
136
|
+
and so on.
|
199
137
|
|
200
138
|
### Excerpted feeds
|
201
139
|
|
@@ -205,6 +143,34 @@ posts, You can change that to something like `<!--more-->` and place that commen
|
|
205
143
|
split the content there.
|
206
144
|
|
207
145
|
|
146
|
+
### Customizing feed templates
|
147
|
+
|
148
|
+
When you run `$ octopress ink list feeds` the includes and templates section might like this:
|
149
|
+
|
150
|
+
```
|
151
|
+
includes:
|
152
|
+
- entry.xml
|
153
|
+
- head.xml
|
154
|
+
|
155
|
+
templates:
|
156
|
+
- articles.xml # template file
|
157
|
+
/feed/articles/index.xml # page generated from template
|
158
|
+
- category.xml
|
159
|
+
- links.xml
|
160
|
+
/feed/links/index.xml
|
161
|
+
- main.xml
|
162
|
+
/feed/index.xml
|
163
|
+
```
|
164
|
+
|
165
|
+
To customize feed templates and inlcudes, Copy all of the plugin's assets to `_plugins/feeds/` by running this command:
|
166
|
+
|
167
|
+
```
|
168
|
+
octopress ink copy feeds --templates --includes
|
169
|
+
```
|
170
|
+
|
171
|
+
Any changes you make to these templates will override the templates in the plugin. If you want to revert to the defaults, simply delete any file you don't care to override from the `_plugins/feeds/` directory.
|
172
|
+
|
173
|
+
|
208
174
|
## Contributing
|
209
175
|
|
210
176
|
1. Fork it ( https://github.com/octopress/feeds/fork )
|
data/assets/config.yml
CHANGED
@@ -1,8 +1,17 @@
|
|
1
|
-
count: 20
|
2
|
-
excerpts: false #
|
1
|
+
count: 20 # Maximum number of posts in a feed
|
2
|
+
excerpts: false # Use post excerpts in feeds
|
3
3
|
external_links: true # Linkposts should direct visitors to the linked site
|
4
|
+
category_feeds: false # Add a feed for categories
|
5
|
+
categories: [] # Only add feeds for these categories. (empty adds feeds for all categories)
|
4
6
|
|
5
7
|
titles:
|
6
|
-
main
|
7
|
-
|
8
|
-
|
8
|
+
main: site.name - Posts
|
9
|
+
links: site.name - Links-only
|
10
|
+
articles: site.name - Articles-only
|
11
|
+
category: site.name - Posts in category.name
|
12
|
+
|
13
|
+
permalinks:
|
14
|
+
main: /feed/
|
15
|
+
links: /feed/links/
|
16
|
+
articles: /feed/articles/
|
17
|
+
category: /feed/categories/category.name/
|
data/lib/octopress-feeds/tags.rb
CHANGED
@@ -2,8 +2,10 @@ module Octopress
|
|
2
2
|
module Feeds
|
3
3
|
class FeedTag < Liquid::Tag
|
4
4
|
def render(context)
|
5
|
-
Octopress::Ink.plugin('feeds').
|
6
|
-
.
|
5
|
+
Octopress::Ink.plugin('feeds').templates
|
6
|
+
.sort_by { |template| template.file.size }
|
7
|
+
.map { |template| template.pages }
|
8
|
+
.flatten.map {|page| tag(page) }
|
7
9
|
.join("\n")
|
8
10
|
end
|
9
11
|
|
@@ -14,9 +16,7 @@ module Octopress
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def page_title(page)
|
17
|
-
title = page
|
18
|
-
title << ': ' unless title.empty?
|
19
|
-
title << page_title_config(page)
|
19
|
+
title = page_title_config(page)
|
20
20
|
|
21
21
|
if defined?(Octopress::Multilingual) && page.lang
|
22
22
|
title << " (#{Octopress::Multilingual.language_name(page.lang)})"
|
@@ -26,29 +26,36 @@ module Octopress
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def page_title_config(page)
|
29
|
-
plugin =
|
30
|
-
config = plugin.config(page.lang)
|
29
|
+
plugin = Octopress::Ink.plugin('feeds')
|
30
|
+
config = plugin.config(page.lang)['titles']
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
site_name = page.site.config['name'] || ''
|
33
|
+
type = page.data['feed_type']
|
34
|
+
title = config[type]
|
35
|
+
|
36
|
+
if type == 'category'
|
37
|
+
category = page.data['category'].capitalize
|
38
|
+
|
39
|
+
if labels = Octopress.site.config['category_labels']
|
40
|
+
category = labels[category.downcase] || category
|
41
|
+
end
|
42
|
+
|
43
|
+
title = title.sub(/category\.name/, category)
|
36
44
|
end
|
45
|
+
|
46
|
+
title.sub(/site\.name/, site_name)
|
37
47
|
end
|
38
48
|
end
|
39
49
|
|
40
50
|
class FeedUpdatedTag < Liquid::Tag
|
41
51
|
def render(context)
|
42
|
-
feed = context['feed_type']
|
52
|
+
feed = context['page.feed_type']
|
43
53
|
site = context['site']
|
44
54
|
|
45
|
-
|
46
|
-
|
47
|
-
posts = site['articles']
|
48
|
-
when 'linkposts'
|
49
|
-
posts = site['linkposts']
|
55
|
+
if feed == 'category'
|
56
|
+
posts = site['categories'][context['page.category']]
|
50
57
|
else
|
51
|
-
posts = site['posts']
|
58
|
+
posts = site[feed] || site['posts']
|
52
59
|
end
|
53
60
|
|
54
61
|
if posts && !posts.empty?
|
data/lib/octopress-feeds.rb
CHANGED
@@ -4,88 +4,92 @@ require 'octopress-include-tag'
|
|
4
4
|
require 'octopress-return-tag'
|
5
5
|
require 'octopress-date-format'
|
6
6
|
require 'octopress-feeds/tags'
|
7
|
-
require 'octopress-feeds/config-asset'
|
8
7
|
|
9
8
|
|
10
9
|
module Octopress
|
11
10
|
module Feeds
|
12
11
|
class Plugin < Ink::Plugin
|
13
12
|
|
14
|
-
def
|
15
|
-
|
13
|
+
def multilingual?
|
14
|
+
(defined?(Octopress::Multilingual) && !Octopress.site.config['lang'].nil?)
|
16
15
|
end
|
17
16
|
|
18
|
-
def
|
19
|
-
super
|
20
|
-
|
17
|
+
def add_template_pages
|
21
18
|
# Remove linkblog pages if the octopress-linkblog plugin isn't installed
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
if multilingual?
|
20
|
+
# Add pages for other languages
|
21
|
+
Octopress::Multilingual.languages.each do |lang|
|
22
|
+
add_feeds(lang)
|
26
23
|
end
|
24
|
+
else
|
25
|
+
add_feeds
|
27
26
|
end
|
27
|
+
end
|
28
28
|
|
29
|
-
|
29
|
+
def add_feeds(lang=nil)
|
30
30
|
|
31
|
-
|
31
|
+
lang = nil unless multilingual?
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
lang = Octopress.site.config['lang']
|
36
|
-
page.data.merge!({'lang' => lang})
|
37
|
-
page.permalink ||= lang_permalink(page, lang)
|
38
|
-
end
|
33
|
+
config = self.config(lang)
|
34
|
+
files = ['main.xml']
|
39
35
|
|
40
|
-
|
41
|
-
|
36
|
+
if defined? Octopress::Linkblog
|
37
|
+
files.concat %w{links.xml articles.xml}
|
38
|
+
end
|
42
39
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
40
|
+
files.each do |file|
|
41
|
+
add_template_page(file, permalink(file, lang), {
|
42
|
+
'lang' => lang,
|
43
|
+
'feed_type' => feed_type(file)
|
44
|
+
})
|
48
45
|
end
|
49
|
-
end
|
50
46
|
|
51
|
-
|
52
|
-
|
47
|
+
if config['category_feeds']
|
48
|
+
add_category_feeds(config, lang)
|
49
|
+
end
|
53
50
|
end
|
54
51
|
|
55
|
-
def
|
56
|
-
|
57
|
-
|
58
|
-
# For each page template, create a new page, and configure its permalink defaults
|
59
|
-
#
|
60
|
-
@pages.each do |page|
|
61
|
-
# New name for permalink settings in plugin config.yml
|
62
|
-
permalink_name = "#{page.permalink_name}_#{lang}"
|
52
|
+
def add_category_feeds(config, lang)
|
53
|
+
categories = Array(config['categories'])
|
63
54
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
p = page.clone(permalink, permalink_name).merge_data({'lang'=>lang})
|
55
|
+
if categories.empty?
|
56
|
+
if lang
|
57
|
+
categories = Octopres::Multilingual.categories_by_language(lang).keys
|
58
|
+
else
|
59
|
+
categories = Octopress.site.categories.keys
|
70
60
|
end
|
71
61
|
end
|
72
62
|
|
73
|
-
|
63
|
+
categories.each do |category|
|
64
|
+
category = category.downcase
|
65
|
+
dir = config['permalinks']['category'].sub('category.name', category)
|
66
|
+
permalink = File.join(lang || '', dir, 'index.xml')
|
67
|
+
add_template_page('category.xml', permalink, {
|
68
|
+
'lang' => lang,
|
69
|
+
'category' => category,
|
70
|
+
'feed_type' => 'category'
|
71
|
+
})
|
72
|
+
end
|
74
73
|
end
|
75
74
|
|
76
|
-
def
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
75
|
+
def permalink(template, lang)
|
76
|
+
type = feed_type(template)
|
77
|
+
url = File.join(lang || '', config(lang)['permalinks'][type])
|
78
|
+
|
79
|
+
# Allow permalinks to specify a filename (ugh, if you must…)
|
80
|
+
unless File.extname(url) == '.xml'
|
81
|
+
url = File.join(url, 'index.xml')
|
81
82
|
end
|
83
|
+
|
84
|
+
url
|
82
85
|
end
|
83
86
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
87
|
+
# Discern feed type based on filename
|
88
|
+
def feed_type(template)
|
89
|
+
if template =~ /articles/
|
90
|
+
'articles'
|
91
|
+
elsif template =~ /links/
|
92
|
+
'links'
|
89
93
|
else
|
90
94
|
'main'
|
91
95
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-feeds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-ink
|
@@ -161,16 +161,13 @@ files:
|
|
161
161
|
- LICENSE.txt
|
162
162
|
- README.md
|
163
163
|
- assets/config.yml
|
164
|
-
- assets/includes/article-feed.xml
|
165
164
|
- assets/includes/entry.xml
|
166
165
|
- assets/includes/head.xml
|
167
|
-
- assets/
|
168
|
-
- assets/
|
169
|
-
- assets/
|
170
|
-
- assets/
|
171
|
-
- assets/pages/main.xml
|
166
|
+
- assets/templates/articles.xml
|
167
|
+
- assets/templates/category.xml
|
168
|
+
- assets/templates/links.xml
|
169
|
+
- assets/templates/main.xml
|
172
170
|
- lib/octopress-feeds.rb
|
173
|
-
- lib/octopress-feeds/config-asset.rb
|
174
171
|
- lib/octopress-feeds/tags.rb
|
175
172
|
- lib/octopress-feeds/version.rb
|
176
173
|
homepage: https://github.com/octopress/feeds
|
data/assets/pages/articles.xml
DELETED
data/assets/pages/links.xml
DELETED
data/assets/pages/main.xml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module Octopress
|
2
|
-
module Feeds
|
3
|
-
class Config < Ink::Assets::Config
|
4
|
-
def read
|
5
|
-
config = super
|
6
|
-
if defined? Octopress::Multilingual
|
7
|
-
config = Jekyll::Utils.deep_merge_hashes(multilingual_permalinks, config)
|
8
|
-
end
|
9
|
-
config
|
10
|
-
end
|
11
|
-
|
12
|
-
def multilingual_permalinks
|
13
|
-
if lang = Octopress.site.config['lang']
|
14
|
-
{ "permalinks" => {
|
15
|
-
"main" => "/#{lang}/feed/",
|
16
|
-
"links" => "/#{lang}/feed/links/",
|
17
|
-
"articles" => "/#{lang}/feed/articles/"
|
18
|
-
}}
|
19
|
-
else
|
20
|
-
{}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|