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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f264c935532788b05d291d01c76a1a559c7e0af
4
- data.tar.gz: c31b8664e1e0125eb2fdc0e1af7c901859e3f341
3
+ metadata.gz: 52583357f6da6f89fb7d5974c8d2382b5ab050cf
4
+ data.tar.gz: 65dc6fe839ea957e2727745d45c0a724664fd92f
5
5
  SHA512:
6
- metadata.gz: 261edcab26afb5fe009409ac3a9fdc89fe255dc290354fd661b01e0095304c021839920be37e15cfbe1fa9df72c23b448faa339e6aeda37556784d0ccd11bd48
7
- data.tar.gz: 81d03cff3a35358e3afdfcbc6e98b8bf48d67955e18630c02ffbfac693e700e25465ba9f67653b500999bc5930674155fc7ad5817f5405a6fa664bf51aa90404
6
+ metadata.gz: 0cf5c9ca9cd3cc6d0e167fe74767a506b2d548f087a744b836225ed9fc842404b416d7add85a761f80ff4baaa72048a0287c2b72075c124c558fb79b5ec2e860
7
+ data.tar.gz: 0a22283867b34054f4198ddf30a13477acce3c16092a42773b0b5d10da00b1ddf367db8e0ff058f0160a42d7f1764bc5c03f68d2469ad687906bf32f9dabc0cf
@@ -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 link-blogging and multilingual support.
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
- {% feed_tag %}
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
- count: 20 # Maximum number of posts in a feed
102
- excerpts: false # Use post excerpts in feeds
103
- external_links: true # Linkposts should direct visitors to the linked site
104
- category_feeds: false # Add a feed for post categories
105
- categories: [] # Only add feeds for these categories. (empty adds feeds for all categories)
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
- main: site.name - Posts
109
- links: site.name - Links-only
110
- articles: site.name - Articles-only
111
- category: site.name - Posts in category.name
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
- main: /feed/
115
- links: /feed/links/
116
- articles: /feed/articles/
117
- category: /feed/categories/category.name/
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, `site.name` is replaced with the value from your site configuration and `category.name` is replaced with the
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 `/feeds/` will become `/en/feeds/` and `/de/feeds/`
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
@@ -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/
@@ -1,5 +1,5 @@
1
1
  <title type="html">{% return post.title_text || post.title %}</title>
2
- {% if post.linkpost and plugins.feeds.external_links %}
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 %}
@@ -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>{% feed_updated_date %}</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>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  ---
3
3
  {% include feeds:head.xml %}
4
- {% for post in site.linkposts limit:plugins.feeds.count %}
4
+ {% for post in site.articles limit:plugins.feeds.feed_count %}
5
5
  <entry>
6
6
  {% include feeds:entry.xml %}
7
7
  </entry>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  ---
3
3
  {% include feeds:head.xml %}
4
- {% for post in site.categories[page.category] limit:plugins.feeds.count %}
4
+ {% for post in site.categories[page.category] limit:plugins.feeds.feed_count %}
5
5
  <entry>
6
6
  {% include feeds:entry.xml %}
7
7
  </entry>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  ---
3
3
  {% include feeds:head.xml %}
4
- {% for post in site.posts limit:plugins.feeds.count %}
4
+ {% for post in site.linkposts limit:plugins.feeds.feed_count %}
5
5
  <entry>
6
6
  {% include feeds:entry.xml %}
7
7
  </entry>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  ---
3
3
  {% include feeds:head.xml %}
4
- {% for post in site.articles limit:plugins.feeds.count %}
4
+ {% for post in site.posts limit:plugins.feeds.feed_count %}
5
5
  <entry>
6
6
  {% include feeds:entry.xml %}
7
7
  </entry>
@@ -0,0 +1,9 @@
1
+ ---
2
+ ---
3
+ {% include feeds:head.xml %}
4
+ {% for post in site.tags[page.tag] limit:plugins.feeds.feed_count %}
5
+ <entry>
6
+ {% include feeds:entry.xml %}
7
+ </entry>
8
+ {% endfor %}
9
+ </feed>
@@ -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
- module Octopress
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"
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Feeds
3
- VERSION = "1.4.0"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  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.0
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-02-20 00:00:00.000000000 Z
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/articles.xml
167
- - assets/templates/category.xml
168
- - assets/templates/links.xml
169
- - assets/templates/main.xml
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:
@@ -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
-