octopress-feeds 1.1.4 → 1.1.5

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: 0ab6a2452c4221da4573d329b760e85758012f79
4
- data.tar.gz: 103c8e90cea7ea900b2da96a2d04dd4344de7b40
3
+ metadata.gz: 52a4b6253078bfc8a1b06aa3a24190e20b9b21c4
4
+ data.tar.gz: 76b2efe4c18dbd1339ba4998ce250c6fb7d106f0
5
5
  SHA512:
6
- metadata.gz: d494dbba64fb24a61c171dc3a3d8e41704a619cfd0f93eef0cbffd0035dcf7f7bfcdcc55379520a8bfc7ea3ec366b577ae24d43ba811ae6f95ca92766f951cb6
7
- data.tar.gz: 0491675cdb1762a79ef24aef3acc44359637cc3a45c20d109ef7d3df7762c91cad21ba2e0f3b9136f12356861af9fb9d538a3417829c1b1338ad24f5eff4c692
6
+ metadata.gz: bc2f1e9653f2b185cfe165a941f9de9af9647a045808dee9f70a446715c4c2e2f8f1259ea654df6019a1f0af6fcca06bcdd58fe010631e37fd6fb1cfcb59611d
7
+ data.tar.gz: 5f6f30515e6890ad9e758d8a2cbe39406a28530ec524129ce07017e8ed9acb2ba97e2ef14b583f17cac01f4d8d03c52ed7c0b2c56802c88743b3c74e34aca895
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.1.5 (2015-01-22)
4
+ - Added support for multilingual feeds via the [octopress-multilingual](https://github.com/octopress/multilingual) plugin.
5
+
3
6
  ### 1.1.4 (2015-01-09)
4
7
  - Fixed invalid whitespace issue, [#6](https://github.com/octopress/feeds/issues/6).
5
8
 
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Octopress Feeds
2
2
 
3
- Add nice RSS feeds to Octopress and Jekyll sites. Supports a standard feed, an articles-only feed and a link-post feed.
3
+ RSS feeds for Jekyll sites, featuring link-blogging and multilingual support.
4
+
4
5
 
5
6
  ## Installation
6
7
 
@@ -27,29 +28,97 @@ Then add the gem to your Jekyll configuration.
27
28
 
28
29
  ## Usage
29
30
 
30
- Be sure your Jekyll configuration has a `url`, a `name` and an `author`. If you want your feed to have link-blogging features, be sure
31
- to install [Octopress Linkblog](https://github.com/octopress/linkblog).
31
+ For link blogging features (article-only and link-only feeds), install [octopress-linkblog](https://github.com/octopress/linkblog).
32
+ For secondary language feeds, install [octopress-multilingual](https://github.com/octopress/multilingual).
33
+
34
+ Be sure your Jekyll configuration has a `url`, a `name` and an `author`.
32
35
 
33
36
  ```yaml
34
37
  url: http://yoursite.com/
35
- name: My Awesome Site
38
+ name: Your Site Name
36
39
  author: Guy McDude
37
40
  ```
38
41
 
39
- Next generate your site with `jekyll build` and an xml feed will be generated at `/feeds/index.xml`.
42
+ Next, add a `<link>` tag to your site's `<head>`.
43
+
44
+ ```html
45
+ <head>
46
+ {% feed_tag %}
47
+ </head>
48
+ ```
49
+
50
+ This would output:
51
+
52
+ ```html
53
+ <head>
54
+ <link href='http://yoursite.com/feed/' title='Your Site Name: Main Feed' rel='alternate' type='application/atom+xml'>
55
+ </head>
56
+ ```
57
+
58
+ That's it. When you build your site with `jekyll build` and this plugin will generate RSS feed(s) and generate the proper `<link>`
59
+ tags.
60
+
61
+ ## Link-blogging
62
+
63
+ Install [octopress-linkblog](https://github.com/octopress/linkblog) and posts with an `external-url` will be added to a feed at `/feeds/links/index.xml` while an articles-only feed will be generated at `/feeds/articles/index.xml`.
64
+
65
+ ## Multilingual support
66
+
67
+ If you are using [octopress-multilingual](https://github.com/octopress/multilingual), adding a secondary language feed is pretty simple. Let's say your primary language is English, but you want to add a German feed. Here's what you'd do.
68
+
69
+ First, create a language feed at `/de/feed/index.xml` (or whatever path suits your site) and add the following.
70
+
71
+ ```
72
+ ---
73
+ feed: true
74
+ title: Deutsch feed
75
+ ---
76
+ {% include feeds:main-feed.xml lang='de' %}
77
+ ```
78
+
79
+ 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
80
+ expect will show up as your feed title in RSS readers.
81
+
82
+ 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.
83
+
84
+ To create an articles feed, add a file to `/de/feed/articles/index.xml` (or wherever suits your site) containing the following:
85
+
86
+ ```
87
+ ---
88
+ feed:true
89
+ title: Deutsch Artikel Feed
90
+ ---
91
+ {% include feeds:article-feed.xml lang='de' %}
92
+ ```
93
+
94
+ To add a link posts feed, add a file to `/de/feed/links/index.xml` containing the following:
40
95
 
41
- To be sure you've installed the plugin correctly, run `octopress ink list feeds` which will list detailed information about the plugin.
96
+ ```
97
+ ---
98
+ feed:true
99
+ title: Deutsch Link Feed
100
+ ---
101
+ {% include feeds:article-feed.xml lang='de' %}
102
+ ```
103
+
104
+ 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.
105
+
106
+ ## Customization
107
+
108
+ To list detailed information about this plugin, run `$ octopress ink list feeds`. This will output something like this:
42
109
 
43
110
  ```
44
- Plugin: Octopress Feeds - v1.1.3
111
+ Plugin: Octopress Feeds - v1.1.5
45
112
  Slug: feeds
46
- A nice RSS feed for Octopress and Jekyll sites.
47
- https://github.com/octopress/feed
113
+ RSS feeds for Jekyll sites, featuring link-blogging and multilingual support.
114
+ https://github.com/octopress/feeds
48
115
  =============================================================
49
116
  includes:
117
+ - article-feed.xml
50
118
  - entry.xml
51
119
  - head.xml
52
- - index.xml
120
+ - link-feed.xml
121
+ - main-feed.xml
53
122
 
54
123
  pages: urls:
55
124
  - article-feed.xml /feed/articles/index.xml
@@ -66,9 +135,7 @@ pages: urls:
66
135
 
67
136
  NOTE: Any relative URLs in your posts will be expanded based on your site's `url` configuration.
68
137
 
69
- ## Customization
70
-
71
- Octopress Ink can copy all of the plugin's assets to `_plugins/feed/*` where you can override them with your own modifications. This is
138
+ Octopress Ink can copy all of the plugin's assets to `_plugins/feeds/*` where you can override them with your own modifications. This is
72
139
  only necessary if you want to modify this plugin's behavior.
73
140
 
74
141
  ```
@@ -81,9 +148,18 @@ If you want to revert to the defaults, simply delete any file you don't care to
81
148
 
82
149
  ## Configuration
83
150
 
151
+ To configure this plugin, first create a configuration file at `_plugins/feeds/config.yml`. If you like, you can have Octopress Ink add it for you.
152
+
153
+ ```
154
+ $ octopress ink copy feeds --config-file
155
+ ```
156
+
157
+ This will create a configuration file populated with the defaults for this plugin. Deleting this file will restore the default configuration.
158
+
159
+
84
160
  | Option | Description | Default |
85
161
  |:----------------------|:------------------------------------------------------------|:------------|
86
- | `count` | How many posts should appear in your feed. | 20 |
162
+ | `count` | How many posts should appear in your feeds. | 20 |
87
163
  | `excerpts` | Feed entries will contain excerpts of post content. | false |
88
164
  | `external_linkposts` | Link posts should direct visitors to the linked site. | true |
89
165
  | `articles_feed` | Add an additional articles-only feed. | false |
@@ -94,14 +170,6 @@ post at the first double line-break, `\n\n`. If you want more control over where
94
170
  posts, You can change that to something like `<!--more-->` and place that comment wherever you like in your post to
95
171
  split the content there.
96
172
 
97
- To configure this plugin, first create a configuration file at `_plugins/feeds/config.yml`. If you like, you can have Octopress Ink add it for you.
98
-
99
- ```
100
- octopress ink copy feeds --config-file
101
- ```
102
-
103
- This will create a configuration file populated with the defaults for this plugin. Deleting this file will restore the default configuration.
104
-
105
173
  ## Contributing
106
174
 
107
175
  1. Fork it ( https://github.com/octopress/feeds/fork )
@@ -0,0 +1,7 @@
1
+ {% assign feed_type = 'articles' %}{% set_lang include.lang %}{% include feeds:head.xml %}
2
+ {% for post in site.articles limit:plugins.feeds.count %}
3
+ <entry>
4
+ {% include feeds:entry.xml %}
5
+ </entry>
6
+ {% endfor %}
7
+ </feed>{% endset_lang %}
@@ -12,7 +12,7 @@
12
12
  <name>{% return post.author || site.author %}</name>
13
13
  <uri>{% return post.author_site || site.url %}</uri>
14
14
  </author>
15
- <content type="html" xml:base="{{ site.url }}" xml:lang="en">
15
+ <content type="html" xml:base="{{ site.url }}" xml:lang="{% return site.lang || 'en' %}">
16
16
  <![CDATA[
17
17
  {% if plugins.feeds.excerpts and post.linkpost == false %}
18
18
  {{ post.excerpt | full_urls }}
@@ -6,4 +6,5 @@
6
6
  <id>{{ site.url }}</id>
7
7
  <updated>{% feed_updated_date %}</updated>
8
8
  <generator uri="http://octopress.org/">Octopress</generator>
9
+ <language>{{ site.lang }}</language>
9
10
  <rights>Copyright © {{ site.time | date: '%Y' }}, {{ site.author | strip_html }}</rights>
@@ -0,0 +1,7 @@
1
+ {% assign feed_type = 'linkposts' %}{% set_lang include.lang %}{% include feeds:head.xml %}
2
+ {% for post in site.linkposts limit:plugins.feeds.count %}
3
+ <entry>
4
+ {% include feeds:entry.xml %}
5
+ </entry>
6
+ {% endfor %}
7
+ </feed>{% endset_lang %}
@@ -0,0 +1,7 @@
1
+ {% assign feed_type = 'posts' %}{% set_lang include.lang %}{% include feeds:head.xml %}
2
+ {% for post in site.posts limit:plugins.feeds.count %}
3
+ <entry>
4
+ {% include feeds:entry.xml %}
5
+ </entry>
6
+ {% endfor %}
7
+ </feed>{% endset_lang %}
@@ -1,13 +1,6 @@
1
1
  ---
2
2
  permalink: /feed/articles/
3
- title: Articles-only Feed
4
- feed: articles
3
+ title: Articles Feed
4
+ feed: true
5
5
  ---
6
- {% if site.articles and site.articles.size > 0 and plugins.feeds.articles_feed %}{% include feeds:head.xml %}
7
- {% for post in site.articles limit:plugins.feeds.count %}
8
- <entry>
9
- {% include feeds:entry.xml %}
10
- </entry>
11
- {% endfor %}
12
- </feed>
13
- {% else %}{% abort %}{% endif %}
6
+ {% abort unless site.articles and site.articles.size > 0 and plugins.feeds.articles_feed %}{% include feeds:article-feed.xml %}
@@ -1,13 +1,6 @@
1
1
  ---
2
2
  permalink: /feed/links/
3
- title: Linkpost Feed
4
- feed: linkposts
3
+ title: Links Feed
4
+ feed: true
5
5
  ---
6
- {% if site.linkposts and site.linkposts.size > 0 and plugins.feeds.linkposts_feed %}{% include feeds:head.xml %}
7
- {% for post in site.linkposts limit:plugins.feeds.count %}
8
- <entry>
9
- {% include feeds:entry.xml %}
10
- </entry>
11
- {% endfor %}
12
- </feed>
13
- {% else %}{% abort %}{% endif %}
6
+ {% abort unless site.linkposts and site.linkposts.size > 0 and plugins.feeds.linkposts_feed %}{% include feeds:link-feed.xml %}
@@ -1,12 +1,6 @@
1
1
  ---
2
2
  permalink: /feed/
3
3
  title: Main Feed
4
- feed: posts
4
+ feed: true
5
5
  ---
6
- {% include feeds:head.xml %}
7
- {% for post in site.posts limit:plugins.feeds.count %}
8
- <entry>
9
- {% include feeds:entry.xml %}
10
- </entry>
11
- {% endfor %}
12
- </feed>
6
+ {% include feeds:main-feed.xml %}
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Feeds
3
- VERSION = "1.1.4"
3
+ VERSION = "1.1.5"
4
4
  end
5
5
  end
@@ -13,25 +13,31 @@ module Octopress
13
13
  module Feeds
14
14
  class FeedTag < Liquid::Tag
15
15
  def render(context)
16
- tags = []
17
-
18
- Ink.plugin('feeds').pages.dup.map do |p|
19
- if p.filename == 'main-feed.xml' && !p.disabled?
20
- tag(p.page)
21
- end
22
- end
16
+ context['site.pages'].dup \
17
+ .select { |p| p.data['feed'] } \
18
+ .map { |p| tag(p) } \
19
+ .join("\n")
23
20
  end
24
21
 
25
22
  def tag(page)
26
- url = page.url.sub(/index\.xml/, '')
27
- "<link href='#{url}' rel='alternate' title='#{page.data['title']}: #{Octopress.site.config['name']}' type='application/atom+xml'>"
23
+ url = page.url.sub(File.basename(page.url), '')
24
+
25
+ "<link href='#{url}' title='#{page_title(page)}' rel='alternate' type='application/atom+xml'>"
26
+ end
27
+
28
+ def page_title(page)
29
+ title = page.site.config['name'].dup || ''
30
+ title << ': ' unless title.empty?
31
+ title << page.data['title']
32
+
33
+ title
28
34
  end
29
35
  end
30
36
 
31
37
  class FeedUpdatedTag < Liquid::Tag
32
38
  def render(context)
33
- feed = context.environments.first['page']['feed'] || 'posts'
34
- site = context.environments.first['site']
39
+ feed = context['feed_type'] || 'posts'
40
+ site = context['site']
35
41
 
36
42
  case feed
37
43
  when 'articles'
@@ -54,19 +60,22 @@ module Octopress
54
60
  end
55
61
  end
56
62
 
57
-
58
-
59
63
  Liquid::Template.register_tag('feed_tag', Octopress::Feeds::FeedTag)
60
64
  Liquid::Template.register_tag('feed_updated_date', Octopress::Feeds::FeedUpdatedTag)
61
65
 
66
+ # A placeholder for smooth integration of Octopress Multilingual
67
+ unless defined? Octopress::Multilingual
68
+ Liquid::Template.register_tag('set_lang', Liquid::Block)
69
+ end
70
+
62
71
  Octopress::Ink.add_plugin({
63
72
  name: "Octopress Feeds",
64
73
  slug: "feeds",
65
74
  gem: "octopress-feeds",
66
- path: File.expand_path(File.join(File.dirname(__FILE__), "../")),
75
+ path: File.expand_path(File.join(File.dirname(__FILE__), "..")),
67
76
  type: "plugin",
68
77
  version: Octopress::Feeds::VERSION,
69
- description: "RSS feeds supporting link-blogging for Octopress and Jekyll sites.",
78
+ description: "RSS feeds for Jekyll sites, featuring link-blogging and multilingual support",
70
79
  website: "https://github.com/octopress/feeds"
71
80
  })
72
81
 
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.1.4
4
+ version: 1.1.5
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-09 00:00:00.000000000 Z
11
+ date: 2015-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octopress-ink
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: octopress-multilingual
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: pry-byebug
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -161,8 +175,11 @@ files:
161
175
  - LICENSE.txt
162
176
  - README.md
163
177
  - assets/config.yml
178
+ - assets/includes/article-feed.xml
164
179
  - assets/includes/entry.xml
165
180
  - assets/includes/head.xml
181
+ - assets/includes/link-feed.xml
182
+ - assets/includes/main-feed.xml
166
183
  - assets/pages/article-feed.xml
167
184
  - assets/pages/link-feed.xml
168
185
  - assets/pages/main-feed.xml