octopress-feeds 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -2
- data/README.md +31 -12
- data/assets/config.yml +5 -0
- data/assets/pages/articles.xml +0 -1
- data/assets/pages/links.xml +0 -1
- data/assets/pages/main.xml +0 -1
- data/lib/octopress-feeds/tags.rb +15 -5
- data/lib/octopress-feeds/version.rb +1 -1
- data/lib/octopress-feeds.rb +24 -10
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de2c2678a23fef0f6044f3f6ab6152a82caf14d3
|
4
|
+
data.tar.gz: 831f85ddee7b54f777c22d579b4f45e161078f73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb6ce3d0629e7c0683652d0dcc12d28b01673c9930db3d19a2b18c0297564240195de33bb917a1ed36cd53dc7044c38b41839880927d081aae658eae38072e46
|
7
|
+
data.tar.gz: 2e7775197b9c7933555f59e2e232120c6bd03acfd63c507f6c882589e45f3e8e0e107bd1605c17a8cb7328a9c7148af3a0f9bb0de87e42ed07b519fb114b2e51
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 1.3.2 (2015-02-08)
|
4
|
+
|
5
|
+
- New: Feed titles can be configured (for additional languages too).
|
6
|
+
|
3
7
|
### 1.3.1 (2015-02-03)
|
4
8
|
|
5
|
-
-
|
9
|
+
- Feed titles include the full language name.
|
6
10
|
|
7
11
|
### 1.3.0 (2015-02-01)
|
8
12
|
|
9
|
-
-
|
13
|
+
- New: All language feeds are automatically generated.
|
10
14
|
|
11
15
|
### 1.2.7 (2015-01-31)
|
12
16
|
|
data/README.md
CHANGED
@@ -102,15 +102,19 @@ https://github.com/octopress/feeds
|
|
102
102
|
- link-feed.xml
|
103
103
|
- main-feed.xml
|
104
104
|
|
105
|
-
pages:
|
106
|
-
- main
|
107
|
-
- links
|
108
|
-
- articles
|
105
|
+
pages: urls:
|
106
|
+
- main.xml /feed/
|
107
|
+
- links.xml /feed/links/ # with octopress-linkblog
|
108
|
+
- articles.xml /feed/articles/ # with octopress-linkblog
|
109
109
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
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"
|
114
118
|
```
|
115
119
|
|
116
120
|
If you have posts written in English and German, and are using [octopress-multilingual](https://github.com/octopress/multilingual),
|
@@ -121,9 +125,9 @@ pages: urls:
|
|
121
125
|
- main /en/feed/
|
122
126
|
- links /en/feed/links/
|
123
127
|
- articles /en/feed/articles/
|
124
|
-
-
|
125
|
-
-
|
126
|
-
-
|
128
|
+
- main_de /de/feed/
|
129
|
+
- links_de /de/feed/links/
|
130
|
+
- articles_de /de/feed/articles/
|
127
131
|
```
|
128
132
|
|
129
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
|
@@ -155,8 +159,23 @@ This will create a configuration file populated with the defaults for this plugi
|
|
155
159
|
| `external_linkposts` | Link posts should direct visitors to the linked site. | true |
|
156
160
|
| `articles_feed` | Add an additional articles-only feed. | false |
|
157
161
|
| `linkposts_feed` | Add an additional link-posts-only feed. | false |
|
158
|
-
| `
|
162
|
+
| `titles` | Set feed titles for main, article, and link feeds. | [see below] |
|
163
|
+
| `permalinks` | Set the permalink for feed pages. | {} |
|
164
|
+
|
165
|
+
|
166
|
+
### Feed titles
|
167
|
+
|
168
|
+
The `titles` configuration allows you to control the title that RSS subscribers see for your feed.
|
169
|
+
|
170
|
+
```yaml
|
171
|
+
titles:
|
172
|
+
main-feed: Posts Feed
|
173
|
+
article-feed: Articles-only Feed
|
174
|
+
link-feed: Links-only Feed
|
175
|
+
```
|
159
176
|
|
177
|
+
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
|
+
feeds, you would add a config file at `_plugins/feeds/config_de.yml` and set titles for your German language feeds.
|
160
179
|
|
161
180
|
### Feed permalinks
|
162
181
|
|
data/assets/config.yml
CHANGED
data/assets/pages/articles.xml
CHANGED
data/assets/pages/links.xml
CHANGED
data/assets/pages/main.xml
CHANGED
data/lib/octopress-feeds/tags.rb
CHANGED
@@ -2,9 +2,8 @@ module Octopress
|
|
2
2
|
module Feeds
|
3
3
|
class FeedTag < Liquid::Tag
|
4
4
|
def render(context)
|
5
|
-
|
6
|
-
.
|
7
|
-
.map { |p| tag(p) } \
|
5
|
+
Octopress::Ink.plugin('feeds').pages.dup
|
6
|
+
.map { |p| tag(p.page) }
|
8
7
|
.join("\n")
|
9
8
|
end
|
10
9
|
|
@@ -17,7 +16,7 @@ module Octopress
|
|
17
16
|
def page_title(page)
|
18
17
|
title = page.site.config['name'].dup || ''
|
19
18
|
title << ': ' unless title.empty?
|
20
|
-
title << page
|
19
|
+
title << page_title_config(page)
|
21
20
|
|
22
21
|
if defined?(Octopress::Multilingual) && page.lang
|
23
22
|
title << " (#{Octopress::Multilingual.language_name(page.lang)})"
|
@@ -25,6 +24,17 @@ module Octopress
|
|
25
24
|
|
26
25
|
title
|
27
26
|
end
|
27
|
+
|
28
|
+
def page_title_config(page)
|
29
|
+
plugin = page.plugin
|
30
|
+
config = plugin.config(page.lang)
|
31
|
+
|
32
|
+
case plugin.feed_type(page.asset)
|
33
|
+
when 'article'; config['titles']['article-feed']
|
34
|
+
when 'link'; config['titles']['link-feed']
|
35
|
+
else config['titles']['main-feed']
|
36
|
+
end
|
37
|
+
end
|
28
38
|
end
|
29
39
|
|
30
40
|
class FeedUpdatedTag < Liquid::Tag
|
@@ -41,7 +51,7 @@ module Octopress
|
|
41
51
|
posts = site['posts']
|
42
52
|
end
|
43
53
|
|
44
|
-
if !posts.empty?
|
54
|
+
if posts && !posts.empty?
|
45
55
|
post = posts.sort_by do |p|
|
46
56
|
p.data['date_updated'] || p.date
|
47
57
|
end.last
|
data/lib/octopress-feeds.rb
CHANGED
@@ -33,20 +33,26 @@ module Octopress
|
|
33
33
|
|
34
34
|
# Add default language to main feeds
|
35
35
|
@pages.each do |page|
|
36
|
-
|
36
|
+
lang = Octopress.site.config['lang']
|
37
|
+
page.data.merge!({'lang' => lang})
|
38
|
+
page.permalink ||= lang_permalink(page, lang)
|
37
39
|
end
|
38
40
|
|
39
41
|
# Ensure multilingual pages are set up for `ink list` view
|
40
42
|
Octopress.site.read if Octopress.site.posts.empty?
|
41
43
|
|
42
44
|
# Add pages for other languages
|
43
|
-
Octopress.
|
44
|
-
next if lang == Octopress.
|
45
|
+
Octopress::Multilingual.languages.each do |lang|
|
46
|
+
next if lang == Octopress::Multilingual.main_language
|
45
47
|
@pages.concat add_lang_pages(lang)
|
46
48
|
end
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
52
|
+
def lang_permalink(page, lang)
|
53
|
+
File.join("/#{lang}", "feed", feed_url(page), '/')
|
54
|
+
end
|
55
|
+
|
50
56
|
def add_lang_pages(lang)
|
51
57
|
lang_pages = []
|
52
58
|
|
@@ -54,10 +60,10 @@ module Octopress
|
|
54
60
|
#
|
55
61
|
@pages.each do |page|
|
56
62
|
# New name for permalink settings in plugin config.yml
|
57
|
-
permalink_name = "#{page.permalink_name}
|
63
|
+
permalink_name = "#{page.permalink_name}_#{lang}"
|
58
64
|
|
59
|
-
# Set the permalink
|
60
|
-
permalink = File.join("/#{lang}", "feed",
|
65
|
+
# Set the permalink default to /[lang]/feed/[type]
|
66
|
+
permalink = File.join("/#{lang}", "feed", feed_url(page), '/')
|
61
67
|
|
62
68
|
# Create a copy of the page
|
63
69
|
lang_pages << page.clone(permalink_name, permalink, {'lang'=>lang})
|
@@ -66,13 +72,21 @@ module Octopress
|
|
66
72
|
lang_pages.sort_by {|p| p.path.size }
|
67
73
|
end
|
68
74
|
|
75
|
+
def feed_url(page)
|
76
|
+
case feed_type(page)
|
77
|
+
when 'article'; 'articles'
|
78
|
+
when 'link'; 'links'
|
79
|
+
else ''
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
69
83
|
def feed_type(page)
|
70
|
-
|
71
|
-
'
|
84
|
+
if page.file =~ /article/
|
85
|
+
'article'
|
72
86
|
elsif page.file =~ /link/
|
73
|
-
'
|
87
|
+
'link'
|
74
88
|
else
|
75
|
-
''
|
89
|
+
'main'
|
76
90
|
end
|
77
91
|
end
|
78
92
|
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.3.
|
4
|
+
version: 1.3.2
|
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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-ink
|
@@ -150,20 +150,6 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: pry-byebug
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
154
|
name: octopress-debugger
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|