buttercms 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rst +8 -0
- data/app/controllers/buttercms/blog_controller.rb +21 -0
- data/app/views/buttercms/blog/feed.atom.builder +16 -0
- data/app/views/buttercms/blog/feed.rss.builder +21 -0
- data/config/routes.rb +5 -0
- data/lib/buttercms/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fe5c385b9495ca5cf605b492da7c919691b9e38
|
4
|
+
data.tar.gz: 4a46cedaaa012e4eafb23b5113339f102891fd98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfbe6e7b9e6b80a9281e8d6d77cc8838a4923443a849c8f5c4866fe1a3c0419ef738e365826914ba766552cc84c222b9487a9869a35eeebc17a4c104ee51d7c8
|
7
|
+
data.tar.gz: 749ab9ddd5b55494dbd27f2e6e694c5d138861a70cdfb3b753d74dfd6e3d0c1b0281dbc78881554ee548018b9bee268287285a81ad37977a4f626a4df071a3a4
|
data/README.rst
CHANGED
@@ -13,6 +13,14 @@ Butter provides a user friendly blogging UI, hosted on buttercms.com, and expose
|
|
13
13
|
This package provides a Rails Engine that interacts with the Butter API to get you up and running in seconds.
|
14
14
|
|
15
15
|
|
16
|
+
Feeds
|
17
|
+
=====================
|
18
|
+
Your new blog comes built-in with a RSS + Atom feeds for maximum SEO benefit. You can use these to syndicate your content to social networks, RSS readers and more.
|
19
|
+
|
20
|
+
RSS: http://localhost:3000/blog/rss/
|
21
|
+
Atom: http://localhost:3000/blog/atom/
|
22
|
+
|
23
|
+
|
16
24
|
============
|
17
25
|
Installation
|
18
26
|
============
|
@@ -124,5 +124,26 @@ module Buttercms
|
|
124
124
|
|
125
125
|
render template: "blog/category"
|
126
126
|
end
|
127
|
+
|
128
|
+
|
129
|
+
def feed
|
130
|
+
|
131
|
+
response = make_butter_request("#{API_URL}posts/")
|
132
|
+
response_json = JSON.parse(response)
|
133
|
+
@recent_posts = response_json['results']
|
134
|
+
|
135
|
+
respond_to do |format|
|
136
|
+
format.rss { render layout: false }
|
137
|
+
format.atom { render layout: false }
|
138
|
+
end
|
139
|
+
|
140
|
+
# respond_to do |format|
|
141
|
+
# format.atom { render :layout => false }
|
142
|
+
|
143
|
+
# # we want the RSS feed to redirect permanently to the ATOM feed
|
144
|
+
# format.rss { redirect_to feed_path(:format => :atom), :status => :moved_permanently }
|
145
|
+
# end
|
146
|
+
end
|
147
|
+
|
127
148
|
end
|
128
149
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
atom_feed :language => 'en-US' do |feed|
|
2
|
+
feed.title 'Latest blog posts'
|
3
|
+
|
4
|
+
for post in @recent_posts
|
5
|
+
xml.entry do
|
6
|
+
xml.title post['title']
|
7
|
+
xml.id post['url']
|
8
|
+
xml.link :href => post['url']
|
9
|
+
xml.updated post['published']
|
10
|
+
|
11
|
+
xml.author do |author|
|
12
|
+
author.name "#{post['author']['first_name']} #{post['author']['last_name']}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
xml.instruct!
|
2
|
+
xml.rss :version => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom' do
|
3
|
+
|
4
|
+
xml.channel do
|
5
|
+
xml.title 'Latest blog posts'
|
6
|
+
xml.link blog_url
|
7
|
+
xml.language 'en-us'
|
8
|
+
|
9
|
+
for post in @recent_posts
|
10
|
+
xml.item do
|
11
|
+
xml.title post['title']
|
12
|
+
xml.description post['summary']
|
13
|
+
xml.link post['url']
|
14
|
+
xml.tag!("dc:creator", post['author']['first_name'])
|
15
|
+
xml.guid post['url']
|
16
|
+
xml.pubDate(post['published'])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
data/config/routes.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
Buttercms::Engine.routes.draw do
|
2
2
|
get '/' => 'blog#butter_home', as: :blog
|
3
|
+
|
4
|
+
# Feeds
|
5
|
+
get '/rss/' => 'blog#feed', :format => 'rss', as: :blog_rss
|
6
|
+
get '/atom/' => 'blog#feed', :format => 'atom', as: :blog_atom
|
7
|
+
|
3
8
|
get '/page/:page' => 'blog#butter_home', as: :archive
|
4
9
|
get '/author/:author_slug' => 'blog#butter_author', as: :blog_author
|
5
10
|
get '/category/:category_slug' => 'blog#butter_category', as: :blog_category
|
data/lib/buttercms/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buttercms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ButterCms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -85,6 +85,8 @@ files:
|
|
85
85
|
- app/assets/stylesheets/buttercms/application.css
|
86
86
|
- app/controllers/buttercms/blog_controller.rb
|
87
87
|
- app/helpers/buttercms/application_helper.rb
|
88
|
+
- app/views/buttercms/blog/feed.atom.builder
|
89
|
+
- app/views/buttercms/blog/feed.rss.builder
|
88
90
|
- app/views/layouts/buttercms/application.html.erb
|
89
91
|
- buttercms.gemspec
|
90
92
|
- config/routes.rb
|