octopress-feeds 1.4.0 → 2.0.0
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 -0
- data/README.md +24 -17
- data/assets/config.yml +0 -17
- data/assets/includes/entry.xml +1 -1
- data/assets/includes/head.xml +1 -1
- data/assets/templates/{links.xml → articles_feed.xml} +1 -1
- data/assets/templates/{category.xml → category_feed.xml} +1 -1
- data/assets/templates/{main.xml → links_feed.xml} +1 -1
- data/assets/templates/{articles.xml → main_feed.xml} +1 -1
- data/assets/templates/tag_feed.xml +9 -0
- data/lib/octopress-feeds.rb +1 -95
- data/lib/octopress-feeds/version.rb +1 -1
- metadata +7 -7
- data/lib/octopress-feeds/tags.rb +0 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52583357f6da6f89fb7d5974c8d2382b5ab050cf
|
4
|
+
data.tar.gz: 65dc6fe839ea957e2727745d45c0a724664fd92f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cf5c9ca9cd3cc6d0e167fe74767a506b2d548f087a744b836225ed9fc842404b416d7add85a761f80ff4baaa72048a0287c2b72075c124c558fb79b5ec2e860
|
7
|
+
data.tar.gz: 0a22283867b34054f4198ddf30a13477acce3c16092a42773b0b5d10da00b1ddf367db8e0ff058f0160a42d7f1764bc5c03f68d2469ad687906bf32f9dabc0cf
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 2.0.0 (2015-02-20)
|
4
|
+
- New: Feeds for each post tag (or configure specific tags).
|
5
|
+
- Now integrated with Octopress Ink's plugin bootstrap.
|
6
|
+
- Some configurations have changed, see Readme for details.
|
7
|
+
- Feeds are now plugin templates instead of pages (this only matters if you've been overriding them).
|
8
|
+
|
3
9
|
### 1.4.0 (2015-02-20)
|
4
10
|
- New: Added category index feeds
|
5
11
|
- New: Better configuration management for titles and permalinks
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Octopress Feeds
|
2
2
|
|
3
|
-
RSS feeds for Jekyll sites, featuring
|
3
|
+
RSS feeds for Jekyll sites, featuring:
|
4
|
+
- link-blogging - feeds for links and articles
|
5
|
+
- Feeds for categories and tags
|
6
|
+
- Multilingual support - automatic language specific feeds for all feed types
|
4
7
|
|
5
8
|
[![Build Status](http://img.shields.io/travis/octopress/feeds.svg)](https://travis-ci.org/octopress/feeds)
|
6
9
|
[![Gem Version](http://img.shields.io/gem/v/octopress-feeds.svg)](https://rubygems.org/gems/octopress-feeds)
|
@@ -48,7 +51,7 @@ Next, add a `<link>` tag to your site's `<head>`.
|
|
48
51
|
|
49
52
|
```html
|
50
53
|
<head>
|
51
|
-
{%
|
54
|
+
{% feeds %}
|
52
55
|
</head>
|
53
56
|
```
|
54
57
|
|
@@ -98,30 +101,34 @@ This will create a configuration file populated with the defaults for this plugi
|
|
98
101
|
### Configuration defaults
|
99
102
|
|
100
103
|
```
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
category_feeds: false
|
105
|
-
|
104
|
+
feed_count: 20 # Maximum number of posts in a feed
|
105
|
+
posts_link_out: true # Linkposts should direct visitors to the linked site
|
106
|
+
feed_excerpts: false # Use post excerpts in feeds
|
107
|
+
category_feeds: false # Add a feed for post categories
|
108
|
+
tag_feeds: false # Add a feed for post tags
|
109
|
+
categories: [] # Only add feeds for these categories. (empty adds feeds for all categories)
|
110
|
+
tags: [] # Only add feeds for these tags. (empty adds feeds for all tags)
|
106
111
|
|
107
112
|
titles:
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
113
|
+
main_feed: Posts - :site_name
|
114
|
+
links_feed: Links - :site_name
|
115
|
+
articles_feed: Articles - :site_name
|
116
|
+
category_feed: Posts in :category - :site_name
|
117
|
+
tag_feed: Posts tagged with :tag - :site_name
|
112
118
|
|
113
119
|
permalinks:
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
120
|
+
main_feed: /feed/
|
121
|
+
links_feed: /feed/links/
|
122
|
+
articles_feed: /feed/articles/
|
123
|
+
category_feed: /feed/categories/:category/
|
124
|
+
tag_feed: /feed/tags/:tag/
|
118
125
|
```
|
119
126
|
|
120
127
|
### Feed titles
|
121
128
|
|
122
129
|
The `titles` configuration allows you to control the title that RSS subscribers see for your feed.
|
123
130
|
|
124
|
-
As you'd expect, `
|
131
|
+
As you'd expect, `:site_name` is replaced with the value from your site configuration and `:category` is replaced with the
|
125
132
|
category for that feed.
|
126
133
|
|
127
134
|
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
|
@@ -132,7 +139,7 @@ feeds, you would add a config file at `_plugins/feeds/config_de.yml` and set tit
|
|
132
139
|
You can set the URL for the feed pages by configuring the `permalinks` setting.
|
133
140
|
|
134
141
|
If you are running a multilingual site with [octopress-multilingual](https://github.com/octopress/multilingual) permalinks will be
|
135
|
-
prepended with the lanugage code that corresponds with the posts in that feed. So `/
|
142
|
+
prepended with the lanugage code that corresponds with the posts in that feed. So `/feed/` will become `/en/feed/` and `/de/feed/`
|
136
143
|
and so on.
|
137
144
|
|
138
145
|
### Excerpted feeds
|
data/assets/config.yml
CHANGED
@@ -1,17 +0,0 @@
|
|
1
|
-
count: 20 # Maximum number of posts in a feed
|
2
|
-
excerpts: false # Use post excerpts in feeds
|
3
|
-
external_links: true # Linkposts should direct visitors to the linked site
|
4
|
-
category_feeds: false # Add a feed for categories
|
5
|
-
categories: [] # Only add feeds for these categories. (empty adds feeds for all categories)
|
6
|
-
|
7
|
-
titles:
|
8
|
-
main: site.name - Posts
|
9
|
-
links: site.name - Links-only
|
10
|
-
articles: site.name - Articles-only
|
11
|
-
category: site.name - Posts in category.name
|
12
|
-
|
13
|
-
permalinks:
|
14
|
-
main: /feed/
|
15
|
-
links: /feed/links/
|
16
|
-
articles: /feed/articles/
|
17
|
-
category: /feed/categories/category.name/
|
data/assets/includes/entry.xml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<title type="html">{% return post.title_text || post.title %}</title>
|
2
|
-
{% if post.linkpost and plugins.feeds.
|
2
|
+
{% if post.linkpost and plugins.feeds.posts_link_out %}
|
3
3
|
<link rel="alternate" type="text/html" href="{{ post.external-url }}"/>
|
4
4
|
<link rel="related" type="text/html" href="{{ post.url | canonical_url }}"/>
|
5
5
|
{% else %}
|
data/assets/includes/head.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<link rel="alternate" type="text/html" href="{{ site.url | join_url: site.baseurl }}"/>
|
5
5
|
<link rel="self" type="application/atom+xml" href="{{ page.url | canonical_url }}"/>
|
6
6
|
<id>{{ site.url | join_url: site.baseurl }}</id>
|
7
|
-
<updated>{%
|
7
|
+
<updated>{% feed_updated %}</updated>
|
8
8
|
<generator uri="http://octopress.org/">Octopress</generator>
|
9
9
|
{% if page.lang %}<language>{{ page.lang }}</language>{% endif %}
|
10
10
|
<rights>Copyright © {{ site.time | date: '%Y' }}, {{ site.author | strip_html }}</rights>
|
data/lib/octopress-feeds.rb
CHANGED
@@ -3,107 +3,13 @@ require 'octopress-ink'
|
|
3
3
|
require 'octopress-include-tag'
|
4
4
|
require 'octopress-return-tag'
|
5
5
|
require 'octopress-date-format'
|
6
|
-
require 'octopress-feeds/tags'
|
7
6
|
|
8
7
|
|
9
|
-
|
10
|
-
module Feeds
|
11
|
-
class Plugin < Ink::Plugin
|
12
|
-
|
13
|
-
def multilingual?
|
14
|
-
(defined?(Octopress::Multilingual) && !Octopress.site.config['lang'].nil?)
|
15
|
-
end
|
16
|
-
|
17
|
-
def add_template_pages
|
18
|
-
# Remove linkblog pages if the octopress-linkblog plugin isn't installed
|
19
|
-
if multilingual?
|
20
|
-
# Add pages for other languages
|
21
|
-
Octopress::Multilingual.languages.each do |lang|
|
22
|
-
add_feeds(lang)
|
23
|
-
end
|
24
|
-
else
|
25
|
-
add_feeds
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def add_feeds(lang=nil)
|
30
|
-
|
31
|
-
lang = nil unless multilingual?
|
32
|
-
|
33
|
-
config = self.config(lang)
|
34
|
-
files = ['main.xml']
|
35
|
-
|
36
|
-
if defined? Octopress::Linkblog
|
37
|
-
files.concat %w{links.xml articles.xml}
|
38
|
-
end
|
39
|
-
|
40
|
-
files.each do |file|
|
41
|
-
add_template_page(file, permalink(file, lang), {
|
42
|
-
'lang' => lang,
|
43
|
-
'feed_type' => feed_type(file)
|
44
|
-
})
|
45
|
-
end
|
46
|
-
|
47
|
-
if config['category_feeds']
|
48
|
-
add_category_feeds(config, lang)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def add_category_feeds(config, lang)
|
53
|
-
categories = Array(config['categories'])
|
54
|
-
|
55
|
-
if categories.empty?
|
56
|
-
if lang
|
57
|
-
categories = Octopres::Multilingual.categories_by_language(lang).keys
|
58
|
-
else
|
59
|
-
categories = Octopress.site.categories.keys
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
categories.each do |category|
|
64
|
-
category = category.downcase
|
65
|
-
dir = config['permalinks']['category'].sub('category.name', category)
|
66
|
-
permalink = File.join(lang || '', dir, 'index.xml')
|
67
|
-
add_template_page('category.xml', permalink, {
|
68
|
-
'lang' => lang,
|
69
|
-
'category' => category,
|
70
|
-
'feed_type' => 'category'
|
71
|
-
})
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def permalink(template, lang)
|
76
|
-
type = feed_type(template)
|
77
|
-
url = File.join(lang || '', config(lang)['permalinks'][type])
|
78
|
-
|
79
|
-
# Allow permalinks to specify a filename (ugh, if you must…)
|
80
|
-
unless File.extname(url) == '.xml'
|
81
|
-
url = File.join(url, 'index.xml')
|
82
|
-
end
|
83
|
-
|
84
|
-
url
|
85
|
-
end
|
86
|
-
|
87
|
-
# Discern feed type based on filename
|
88
|
-
def feed_type(template)
|
89
|
-
if template =~ /articles/
|
90
|
-
'articles'
|
91
|
-
elsif template =~ /links/
|
92
|
-
'links'
|
93
|
-
else
|
94
|
-
'main'
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
Octopress::Ink::Plugins.register_plugin(Octopress::Feeds::Plugin, {
|
8
|
+
Octopress::Ink.add_plugin({
|
102
9
|
name: "Octopress Feeds",
|
103
10
|
slug: "feeds",
|
104
11
|
gem: "octopress-feeds",
|
105
12
|
path: File.expand_path(File.join(File.dirname(__FILE__), "..")),
|
106
|
-
type: "plugin",
|
107
13
|
version: Octopress::Feeds::VERSION,
|
108
14
|
description: "RSS feeds for Jekyll sites, featuring link-blogging and multilingual support",
|
109
15
|
website: "https://github.com/octopress/feeds"
|
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:
|
4
|
+
version: 2.0.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-
|
11
|
+
date: 2015-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-ink
|
@@ -163,12 +163,12 @@ files:
|
|
163
163
|
- assets/config.yml
|
164
164
|
- assets/includes/entry.xml
|
165
165
|
- assets/includes/head.xml
|
166
|
-
- assets/templates/
|
167
|
-
- assets/templates/
|
168
|
-
- assets/templates/
|
169
|
-
- assets/templates/
|
166
|
+
- assets/templates/articles_feed.xml
|
167
|
+
- assets/templates/category_feed.xml
|
168
|
+
- assets/templates/links_feed.xml
|
169
|
+
- assets/templates/main_feed.xml
|
170
|
+
- assets/templates/tag_feed.xml
|
170
171
|
- lib/octopress-feeds.rb
|
171
|
-
- lib/octopress-feeds/tags.rb
|
172
172
|
- lib/octopress-feeds/version.rb
|
173
173
|
homepage: https://github.com/octopress/feeds
|
174
174
|
licenses:
|
data/lib/octopress-feeds/tags.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
module Octopress
|
2
|
-
module Feeds
|
3
|
-
class FeedTag < Liquid::Tag
|
4
|
-
def render(context)
|
5
|
-
Octopress::Ink.plugin('feeds').templates
|
6
|
-
.sort_by { |template| template.file.size }
|
7
|
-
.map { |template| template.pages }
|
8
|
-
.flatten.map {|page| tag(page) }
|
9
|
-
.join("\n")
|
10
|
-
end
|
11
|
-
|
12
|
-
def tag(page)
|
13
|
-
url = page.url.sub(File.basename(page.url), '')
|
14
|
-
|
15
|
-
"<link href='#{url}' title='#{page_title(page)}' rel='alternate' type='application/atom+xml'>"
|
16
|
-
end
|
17
|
-
|
18
|
-
def page_title(page)
|
19
|
-
title = page_title_config(page)
|
20
|
-
|
21
|
-
if defined?(Octopress::Multilingual) && page.lang
|
22
|
-
title << " (#{Octopress::Multilingual.language_name(page.lang)})"
|
23
|
-
end
|
24
|
-
|
25
|
-
title
|
26
|
-
end
|
27
|
-
|
28
|
-
def page_title_config(page)
|
29
|
-
plugin = Octopress::Ink.plugin('feeds')
|
30
|
-
config = plugin.config(page.lang)['titles']
|
31
|
-
|
32
|
-
site_name = page.site.config['name'] || ''
|
33
|
-
type = page.data['feed_type']
|
34
|
-
title = config[type]
|
35
|
-
|
36
|
-
if type == 'category'
|
37
|
-
category = page.data['category'].capitalize
|
38
|
-
|
39
|
-
if labels = Octopress.site.config['category_labels']
|
40
|
-
category = labels[category.downcase] || category
|
41
|
-
end
|
42
|
-
|
43
|
-
title = title.sub(/category\.name/, category)
|
44
|
-
end
|
45
|
-
|
46
|
-
title.sub(/site\.name/, site_name)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
class FeedUpdatedTag < Liquid::Tag
|
51
|
-
def render(context)
|
52
|
-
feed = context['page.feed_type']
|
53
|
-
site = context['site']
|
54
|
-
|
55
|
-
if feed == 'category'
|
56
|
-
posts = site['categories'][context['page.category']]
|
57
|
-
else
|
58
|
-
posts = site[feed] || site['posts']
|
59
|
-
end
|
60
|
-
|
61
|
-
if posts && !posts.empty?
|
62
|
-
post = posts.sort_by do |p|
|
63
|
-
p.data['date_updated'] || p.date
|
64
|
-
end.last
|
65
|
-
|
66
|
-
post.data['date_updated_xml'] || post.data['date_xml']
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
Liquid::Template.register_tag('feed_tag', Octopress::Feeds::FeedTag)
|
74
|
-
Liquid::Template.register_tag('feed_updated_date', Octopress::Feeds::FeedUpdatedTag)
|
75
|
-
|