octopress-feeds 1.2.7 → 1.3.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
  SHA1:
3
- metadata.gz: 7d307a33c33e838bbe81f6193b41804f7308e912
4
- data.tar.gz: dd85e6ed168dd55d82f2a60747656d1970fde500
3
+ metadata.gz: b0763f000cc10d04b861503e9e83950663abafb8
4
+ data.tar.gz: 9dfd1534121c6aa203c27b2b7b4289affce50f5e
5
5
  SHA512:
6
- metadata.gz: 1ab992ed2c4439b5dcba3e4726465bcb6145bb04b183abe41dee41f91c7a66d1520e3e2367d915131f8ef24562e3c0b6808bbdc26f88b52c3c6b91c8f0a72fcf
7
- data.tar.gz: cf1df6581d4bb85c229a2475ab3373e66ee78f852c0081fb0987851283e0f1026f030982da1772e3d3790c08e96ab2a14d9e8ab6f17f73730e8f24934e97f3d7
6
+ metadata.gz: 9a034ddda257dba71c7b7f5edff3e9f6257cb622ac4792d7bdb2debdee79cc664ca2df92bf83a35a9715e6078c27d7c7d623dd60e2d4261f8f8eafa4a2dddca4
7
+ data.tar.gz: ebaed813e2b84404bdd944dbcc271699daf8f820bf701381655ecdb874403aa9de2cba5fe5c341bf8ddd16935692f5f9211c609a804ee3092f78f11f4007d97b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.3.0 (2015-02-01)
4
+
5
+ - Now all language feeds are automatically generated.
6
+
3
7
  ### 1.2.7 (2015-01-31)
4
8
 
5
9
  - Added support for new octopress-multilingual page.lang feature.
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), your feed urls will be organized by language. If
71
- your site's main language is `en` your English feeds will be here:
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
- /en/links/index.xml # English link posts (if using octopress-linkblog)
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 create an articles feed, add a file to `/de/feed/articles/index.xml` (or wherever suits your site) containing the following:
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
- - article-feed.xml /feed/articles/index.xml
142
- - link-feed.xml /feed/links/index.xml
143
- - main-feed.xml /feed/index.xml
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
- NOTE: Any relative URLs in your posts will be expanded based on your site's `url` configuration.
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-feed: /rss/
194
- link-feed: /rss/links/
195
- article-feed: /rss/articles/
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
- - article-feed.xml /rss/articles/index.xml
203
- - link-feed.xml /rss/links/index.xml
204
- - main-feed.xml /rss/index.xml
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
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  permalink: /feed/articles/
3
- title: Articles Feed
3
+ title: Articles only
4
4
  feed: true
5
- lang: en
6
5
  ---
7
6
  {% include feeds:article-feed.xml %}
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  permalink: /feed/links/
3
- title: Links Feed
3
+ title: Links only
4
4
  feed: true
5
- lang: en
6
5
  ---
7
6
  {% include feeds:link-feed.xml %}
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  permalink: /feed/
3
- title: Main Feed
3
+ title: Posts
4
4
  feed: true
5
- lang: en
6
5
  ---
7
6
  {% include feeds:main-feed.xml %}
@@ -12,9 +12,9 @@ module Octopress
12
12
  def multilingual_permalinks
13
13
  lang = Octopress.site.config['lang']
14
14
  { "permalinks" => {
15
- "main-feed" => "/#{lang}/feed/",
16
- "link-feed" => "/#{lang}/feed/links/",
17
- "article-feed" => "/#{lang}/feed/articles/"
15
+ "main" => "/#{lang}/feed/",
16
+ "links" => "/#{lang}/feed/links/",
17
+ "articles" => "/#{lang}/feed/articles/"
18
18
  }}
19
19
  end
20
20
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Feeds
3
- VERSION = "1.2.7"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -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.2.7
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-31 00:00:00.000000000 Z
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/article-feed.xml
198
- - assets/pages/link-feed.xml
199
- - assets/pages/main-feed.xml
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