octopress-feeds 1.2.7 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +32 -60
- data/assets/pages/{article-feed.xml → articles.xml} +1 -2
- data/assets/pages/{link-feed.xml → links.xml} +1 -2
- data/assets/pages/{main-feed.xml → main.xml} +1 -2
- data/lib/octopress-feeds/config-asset.rb +3 -3
- data/lib/octopress-feeds/tags.rb +4 -1
- data/lib/octopress-feeds/version.rb +1 -1
- data/lib/octopress-feeds.rb +49 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0763f000cc10d04b861503e9e83950663abafb8
|
4
|
+
data.tar.gz: 9dfd1534121c6aa203c27b2b7b4289affce50f5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a034ddda257dba71c7b7f5edff3e9f6257cb622ac4792d7bdb2debdee79cc664ca2df92bf83a35a9715e6078c27d7c7d623dd60e2d4261f8f8eafa4a2dddca4
|
7
|
+
data.tar.gz: ebaed813e2b84404bdd944dbcc271699daf8f820bf701381655ecdb874403aa9de2cba5fe5c341bf8ddd16935692f5f9211c609a804ee3092f78f11f4007d97b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -42,6 +42,8 @@ name: Your Site Name
|
|
42
42
|
author: Guy McDude
|
43
43
|
```
|
44
44
|
|
45
|
+
Note: Relative URLs in your posts will be expanded based on your site's `url` and `basename` configuration.
|
46
|
+
|
45
47
|
Next, add a `<link>` tag to your site's `<head>`.
|
46
48
|
|
47
49
|
```html
|
@@ -67,58 +69,21 @@ Install [octopress-linkblog](https://github.com/octopress/linkblog) and posts wi
|
|
67
69
|
|
68
70
|
## Multilingual support
|
69
71
|
|
70
|
-
If you are using [octopress-multilingual](https://github.com/octopress/multilingual),
|
71
|
-
|
72
|
+
If you are using [octopress-multilingual](https://github.com/octopress/multilingual), additional feeds will automatically be added for
|
73
|
+
each language. Your feed urls will be organized by language. For example:
|
72
74
|
|
73
75
|
```
|
74
76
|
/en/feed/index.xml # All English posts feed
|
75
|
-
/
|
76
|
-
/en/articles/index.xml # English article posts (if using octopress-linkblog)
|
77
|
-
```
|
78
|
-
|
79
|
-
To change the URL for these pages, read the [Feed Permalinks](#feed-permalinks) section below.
|
80
|
-
|
81
|
-
Adding a secondary language feed is pretty simple. Let's say you want to add a German language feed. Here's what you'd do.
|
82
|
-
|
83
|
-
First, create a page at `/de/feed/index.xml` (or whatever path suits your site's URL conventions) and add the following.
|
77
|
+
/de/feed/index.xml # All German posts feed
|
84
78
|
|
79
|
+
# Feeds added with octopress-linkblog
|
80
|
+
/en/feed/articles/index.xml # English articles only feed
|
81
|
+
/en/feed/links/index.xml # English link-posts only feed
|
82
|
+
/de/feed/articles/index.xml # German articles only feed
|
83
|
+
/de/feed/links/index.xml # German link-posts only feed
|
85
84
|
```
|
86
|
-
---
|
87
|
-
feed: true
|
88
|
-
title: Deutsch feed
|
89
|
-
lang: de
|
90
|
-
---
|
91
|
-
{% include feeds:main-feed.xml %}
|
92
|
-
```
|
93
|
-
|
94
|
-
The page config, `feed: true` ensures that it will be added to your site's feed listing with `{% feed_tag %}`. The title, as you'd
|
95
|
-
expect will show up as your feed title in RSS readers.
|
96
|
-
|
97
|
-
If you are using the [octopress-linkblog](https://github.com/octopress/linkblog) plugin, you can also add article-only and link-only feeds for additional languages.
|
98
85
|
|
99
|
-
To
|
100
|
-
|
101
|
-
```
|
102
|
-
---
|
103
|
-
feed:true
|
104
|
-
title: Deutsch Artikel Feed
|
105
|
-
lang: de
|
106
|
-
---
|
107
|
-
{% include feeds:article-feed.xml %}
|
108
|
-
```
|
109
|
-
|
110
|
-
To add a link-posts feed, add a file to `/de/feed/links/index.xml` containing the following:
|
111
|
-
|
112
|
-
```
|
113
|
-
---
|
114
|
-
feed:true
|
115
|
-
title: Deutsch Link Feed
|
116
|
-
lang: de
|
117
|
-
---
|
118
|
-
{% include feeds:article-feed.xml %}
|
119
|
-
```
|
120
|
-
|
121
|
-
That's it. When you generate your site. These feeds should contain only German posts. If you have more than one language, you can just repeat the steps above for each.
|
86
|
+
To change the URL for these pages, read the [Feed Permalinks](#feed-permalinks) section below.
|
122
87
|
|
123
88
|
## Customize feeds
|
124
89
|
|
@@ -138,19 +103,28 @@ https://github.com/octopress/feeds
|
|
138
103
|
- main-feed.xml
|
139
104
|
|
140
105
|
pages: urls:
|
141
|
-
-
|
142
|
-
-
|
143
|
-
-
|
106
|
+
- main /feed/
|
107
|
+
- links /feed/links/ # with octopress-linkblog
|
108
|
+
- articles /feed/articles/ # with octopress-linkblog
|
144
109
|
|
145
110
|
default configuration:
|
146
111
|
count: 20
|
147
112
|
excerpts: false # Feed excerpts post content
|
148
113
|
external_links: true # Linkposts should direct visitors to the linked site
|
149
|
-
articles_feed: false # Add a feed with articles only
|
150
|
-
linkposts_feed: false # Add a feed with linkposts only
|
151
114
|
```
|
152
115
|
|
153
|
-
|
116
|
+
If you have posts written in English and German, and are using [octopress-multilingual](https://github.com/octopress/multilingual),
|
117
|
+
your permalinks will automatically be name-spaced by language, like this:
|
118
|
+
|
119
|
+
```
|
120
|
+
pages: urls:
|
121
|
+
- main /en/feed/
|
122
|
+
- links /en/feed/links/
|
123
|
+
- articles /en/feed/articles/
|
124
|
+
- main-de /de/feed/
|
125
|
+
- links-de /de/feed/links/
|
126
|
+
- articles-de /de/feed/articles/
|
127
|
+
```
|
154
128
|
|
155
129
|
Octopress Ink can copy all of the plugin's assets to `_plugins/feeds/*` where you can override them with your own modifications. This is
|
156
130
|
only necessary if you want to modify this plugin's behavior.
|
@@ -190,22 +164,20 @@ You can set the URL for the feed pages by configuring the `permalink` setting. H
|
|
190
164
|
|
191
165
|
```yaml
|
192
166
|
permalinks:
|
193
|
-
main
|
194
|
-
|
195
|
-
|
167
|
+
main: /rss/
|
168
|
+
links: /rss/links/
|
169
|
+
articles: /rss/articles/
|
196
170
|
```
|
197
171
|
|
198
172
|
Now when you run `$ octopress ink list feeds` the pages section will look like this:
|
199
173
|
|
200
174
|
```
|
201
175
|
pages: urls:
|
202
|
-
-
|
203
|
-
-
|
204
|
-
-
|
176
|
+
- main /rss/
|
177
|
+
- links /rss/links/
|
178
|
+
- articles /rss/articles/
|
205
179
|
```
|
206
180
|
|
207
|
-
Note: Multilingual feeds will not show up here. This only shows pages that come with this plugin.
|
208
|
-
|
209
181
|
### Excerpted feeds
|
210
182
|
|
211
183
|
Post excerpts are determined by Jekyll's `excerpt_separator` configuration. It defaults to splitting your
|
@@ -12,9 +12,9 @@ module Octopress
|
|
12
12
|
def multilingual_permalinks
|
13
13
|
lang = Octopress.site.config['lang']
|
14
14
|
{ "permalinks" => {
|
15
|
-
"main
|
16
|
-
"
|
17
|
-
"
|
15
|
+
"main" => "/#{lang}/feed/",
|
16
|
+
"links" => "/#{lang}/feed/links/",
|
17
|
+
"articles" => "/#{lang}/feed/articles/"
|
18
18
|
}}
|
19
19
|
end
|
20
20
|
end
|
data/lib/octopress-feeds/tags.rb
CHANGED
@@ -4,7 +4,6 @@ module Octopress
|
|
4
4
|
def render(context)
|
5
5
|
context['site.pages'].dup \
|
6
6
|
.select { |p| p.data['feed'] } \
|
7
|
-
.sort_by { |p| p.path.size } \
|
8
7
|
.map { |p| tag(p) } \
|
9
8
|
.join("\n")
|
10
9
|
end
|
@@ -20,6 +19,10 @@ module Octopress
|
|
20
19
|
title << ': ' unless title.empty?
|
21
20
|
title << page.data['title']
|
22
21
|
|
22
|
+
if defined? Octopress::Multilingual
|
23
|
+
title << " (#{page.lang})"
|
24
|
+
end
|
25
|
+
|
23
26
|
title
|
24
27
|
end
|
25
28
|
end
|
data/lib/octopress-feeds.rb
CHANGED
@@ -20,11 +20,60 @@ module Octopress
|
|
20
20
|
super
|
21
21
|
|
22
22
|
# Remove linkblog pages if the octopress-linkblog plugin isn't installed
|
23
|
+
|
23
24
|
unless defined? Octopress::Linkblog
|
24
25
|
@pages.reject! do |p|
|
25
26
|
p.file =~ /(article|link)/
|
26
27
|
end
|
27
28
|
end
|
29
|
+
|
30
|
+
@pages.sort_by! {|p| p.path.size }
|
31
|
+
|
32
|
+
if defined? Octopress::Multilingual
|
33
|
+
|
34
|
+
# Add default language to main feeds
|
35
|
+
@pages.each do |page|
|
36
|
+
page.data.merge!({'lang' => Octopress.site.config['lang']})
|
37
|
+
end
|
38
|
+
|
39
|
+
# Ensure multilingual pages are set up for `ink list` view
|
40
|
+
Octopress.site.read if Octopress.site.posts.empty?
|
41
|
+
|
42
|
+
# Add pages for other languages
|
43
|
+
Octopress.site.languages.each do |lang|
|
44
|
+
next if lang == Octopress.site.config['lang']
|
45
|
+
@pages.concat add_lang_pages(lang)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def add_lang_pages(lang)
|
51
|
+
lang_pages = []
|
52
|
+
|
53
|
+
# For each page template, create a new page, and configure its permalink defaults
|
54
|
+
#
|
55
|
+
@pages.each do |page|
|
56
|
+
# New name for permalink settings in plugin config.yml
|
57
|
+
permalink_name = "#{page.permalink_name}-#{lang}"
|
58
|
+
|
59
|
+
# Set the permalink defaul to /en/feed/[type]
|
60
|
+
permalink = File.join("/#{lang}", "feed", feed_type(page), '/')
|
61
|
+
|
62
|
+
# Create a copy of the page
|
63
|
+
lang_pages << page.clone(permalink_name, permalink, {'lang'=>lang})
|
64
|
+
end
|
65
|
+
|
66
|
+
lang_pages.sort_by {|p| p.path.size }
|
67
|
+
end
|
68
|
+
|
69
|
+
def feed_type(page)
|
70
|
+
url = if page.file =~ /article/
|
71
|
+
'articles'
|
72
|
+
elsif page.file =~ /link/
|
73
|
+
'links'
|
74
|
+
else
|
75
|
+
''
|
76
|
+
end
|
28
77
|
end
|
29
78
|
end
|
30
79
|
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.3.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-01
|
11
|
+
date: 2015-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-ink
|
@@ -194,9 +194,9 @@ files:
|
|
194
194
|
- assets/includes/head.xml
|
195
195
|
- assets/includes/link-feed.xml
|
196
196
|
- assets/includes/main-feed.xml
|
197
|
-
- assets/pages/
|
198
|
-
- assets/pages/
|
199
|
-
- assets/pages/main
|
197
|
+
- assets/pages/articles.xml
|
198
|
+
- assets/pages/links.xml
|
199
|
+
- assets/pages/main.xml
|
200
200
|
- lib/octopress-feeds.rb
|
201
201
|
- lib/octopress-feeds/config-asset.rb
|
202
202
|
- lib/octopress-feeds/tags.rb
|