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 +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +90 -22
- data/assets/includes/article-feed.xml +7 -0
- data/assets/includes/entry.xml +1 -1
- data/assets/includes/head.xml +1 -0
- data/assets/includes/link-feed.xml +7 -0
- data/assets/includes/main-feed.xml +7 -0
- data/assets/pages/article-feed.xml +3 -10
- data/assets/pages/link-feed.xml +3 -10
- data/assets/pages/main-feed.xml +2 -8
- data/lib/octopress-feeds/version.rb +1 -1
- data/lib/octopress-feeds.rb +24 -15
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52a4b6253078bfc8a1b06aa3a24190e20b9b21c4
|
4
|
+
data.tar.gz: 76b2efe4c18dbd1339ba4998ce250c6fb7d106f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
31
|
-
|
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:
|
38
|
+
name: Your Site Name
|
36
39
|
author: Guy McDude
|
37
40
|
```
|
38
41
|
|
39
|
-
Next
|
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
|
-
|
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.
|
111
|
+
Plugin: Octopress Feeds - v1.1.5
|
45
112
|
Slug: feeds
|
46
|
-
|
47
|
-
https://github.com/octopress/
|
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
|
-
-
|
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
|
-
|
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
|
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 )
|
data/assets/includes/entry.xml
CHANGED
@@ -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 }}
|
data/assets/includes/head.xml
CHANGED
@@ -1,13 +1,6 @@
|
|
1
1
|
---
|
2
2
|
permalink: /feed/articles/
|
3
|
-
title: Articles
|
4
|
-
feed:
|
3
|
+
title: Articles Feed
|
4
|
+
feed: true
|
5
5
|
---
|
6
|
-
{%
|
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 %}
|
data/assets/pages/link-feed.xml
CHANGED
@@ -1,13 +1,6 @@
|
|
1
1
|
---
|
2
2
|
permalink: /feed/links/
|
3
|
-
title:
|
4
|
-
feed:
|
3
|
+
title: Links Feed
|
4
|
+
feed: true
|
5
5
|
---
|
6
|
-
{%
|
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 %}
|
data/assets/pages/main-feed.xml
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
---
|
2
2
|
permalink: /feed/
|
3
3
|
title: Main Feed
|
4
|
-
feed:
|
4
|
+
feed: true
|
5
5
|
---
|
6
|
-
{% include feeds:
|
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 %}
|
data/lib/octopress-feeds.rb
CHANGED
@@ -13,25 +13,31 @@ module Octopress
|
|
13
13
|
module Feeds
|
14
14
|
class FeedTag < Liquid::Tag
|
15
15
|
def render(context)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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(
|
27
|
-
|
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
|
34
|
-
site = context
|
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
|
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
|
+
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-
|
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
|