Skip to content

Commit 7262b4e

Browse files
committed
Remove title from RSS
1 parent f8fe69a commit 7262b4e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/encoding_bits/helpers.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ defmodule EncodingBits.Helpers do
1414
end
1515
end
1616

17+
defmacro remove_title(content) do
18+
quote do
19+
Regex.replace(%r/<h1>(.*?)<\/h1>/g, unquote(content), "")
20+
end
21+
end
22+
1723
def title(content) when is_bitstring(content) do
1824
" - #{content}"
1925
end

web/templates/feed.atom.eex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<updated><%= datetime(article) %></updated>
1616
<link type="text/html" rel="alternate" href="http://encodingbits.com/<%= article[:slug] %>"/>
1717
<title><%= article[:title] %></title>
18-
<content type="html"><%= h(article[:body]) %></content>
18+
<content type="html"><%= h(remove_title(article[:body])) %></content>
1919
<author>
2020
<name>Mike Pack</name>
2121
</author>

0 commit comments

Comments
 (0)