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 1 commit
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
9 changes: 7 additions & 2 deletions web/controllers/feed_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ defmodule ElixirStatus.FeedController do
|> send_file(200, "priv/static/images/github/#{user_name}.jpg")
end

def rss(conn, _params) do
def full_feed(conn, _params) do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert all changes to this function.

postings = Posting.published
render(conn, "rss.xml", postings: postings.entries)
render(conn, "full.xml", postings: postings.entries)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please name all templates like their functions.

end

def titles_feed(conn, _params) do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename titles_feed to rss_titles_only.

postings = Posting.published
render(conn, "titles.xml", postings: postings.entries)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename rss_titles_only.xml.

end
end
4 changes: 3 additions & 1 deletion web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ defmodule ElixirStatus.Router do
get "/", PostingController, :index
get "/u/:user_name", PostingController, :user

get "/rss", FeedController, :rss
get "/rss", FeedController, :full_feed
get "/rss-titles", FeedController, :titles_feed
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename rss-titles to rss-titles-only


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

Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions web/templates/feed/titles.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>
3 changes: 2 additions & 1 deletion web/templates/shared/sidebar.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
<span class="sidebar-nav-item sidebar-nav-item--text"><%= gettext "You can follow via" %></span>
<a class="sidebar-nav-item no-hover-decoration" href="http://elixirweekly.net/" target="_blank"><span class="badge badge--new">NEW!</span> <span class="hover-decoration">ElixirWeekly</span></a>
<a class="sidebar-nav-item" href="https://twitter.com/elixirstatus" target="_blank">Twitter</a>
<a class="sidebar-nav-item" href="/rss">RSS</a>
<a class="sidebar-nav-item" href="/rss">RSS (full)</a>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert all changes to this file.

<a class="sidebar-nav-item" href="/rss-titles">RSS (titles)</a>

<span class="sidebar-nav-item sidebar-nav-item--text"><%= gettext "Running on Phoenix!" %></span>
<a class="sidebar-nav-item" href="https://github.com/rrrene/elixirstatus-web" target="_blank"><%= gettext "Open Source" %></a>
Expand Down