Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add titles-only RSS feed #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
5 changes: 5 additions & 0 deletions web/controllers/feed_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ defmodule ElixirStatus.FeedController do
postings = Posting.published
render(conn, "rss.xml", postings: postings.entries)
end

def rss_titles_only(conn, _params) do
postings = Posting.published
render(conn, "rss_titles_only.xml", postings: postings.entries)
end
end
2 changes: 2 additions & 0 deletions web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ defmodule ElixirStatus.Router do
get "/u/:user_name", PostingController, :user

get "/rss", FeedController, :rss
get "/rss-titles-only", FeedController, :rss_titles_only

get "/about", PageController, :about
get "/open_source", PageController, :open_source

Expand Down
16 changes: 16 additions & 0 deletions web/templates/feed/rss_titles_only.xml.eex
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>ElixirStatus</title>
<description><%= ElixirStatus.Meta.rss_title %></description>
<link><%= ElixirStatus.URL.from_path("/") %></link>
<%= for posting <- @postings do %>
<item>
<title><![CDATA[<%= xml_strip_tags posting.title %>]]></title>
<pubDate><%= xml_readable_date posting.published_at %></pubDate>
<link><%= to_permalink(@conn, posting) %></link>
<guid><%= to_permalink(@conn, posting) %></guid>
</item>
<% end %>
</channel>
</rss>