Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/controllers/articles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ def index
@articles = Article.all.order("created_at DESC")
end

def feed
@articles = Article.all.order("created_at DESC")

respond_to do |format|
format.rss { render :layout => false }
end
end

def show
@article = RenderableArticle.new Article.friendly.find(params[:id])

Expand Down
26 changes: 26 additions & 0 deletions app/views/articles/feed.rss.builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#encoding: UTF-8

xml.instruct! :xml, :version => "1.0"
xml.rss :version => "2.0" do
xml.channel do
xml.title "Alexis Fellenius Makrigianni"
xml.description "Alexis is a product designer, digital strategist and partner at Oktavilla"
xml.link "http://lexi.se"
xml.language "en"
xml.tag! 'atom:link', :rel => 'self', :type => 'application/rss+xml', :href => feed_url

for article in @articles
xml.item do
xml.title article.title
xml.author "Alexis Fellenius Makrigianni"
xml.pubDate article.created_at.to_s(:rfc822)
xml.link "#{article_url(article)}"
xml.guid article.id

rendered_article = RenderableArticle.new article
xml.description rendered_article.body

end
end
end
end
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<title><%= @page_title ? "#{@page_title} – Alexis Fellenius Makrigianni" : "Alexis Fellenius Makrigianni is a designer and partner at Oktavilla" %></title>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="alternate" type="application/rss+xml" title="Lexi.se RSS Feed" href="http://lexi.se/feed?format=rss">
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<script type="text/javascript" src="//use.typekit.net/irp6ewa.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

resources :articles

get 'feed' => 'articles#feed'

# Redirect old URLs for moved articles

get '/post/18401593732/thoughts-on-responsive-navigation', to: redirect('/articles/thoughts-on-responsive-navigation')
Expand Down