Improve formatting in RSS feed, to make it valid

master
Raymon Zutekouw 2 years ago
parent 6ed757b81b
commit 266b6e0733
No known key found for this signature in database
GPG Key ID: 1E9BCC39EDD1DD53
  1. 5
      client/gen.exs
  2. 11
      client/templates/post_item.xml
  3. 7
      client/templates/posts.xml

@ -116,7 +116,12 @@ post_contents
|> File.close()
end)
stripForRSS = fn content -> content
|> String.replace("\n", "")
end
post_feed = post_contents
|> Enum.map(fn m -> Map.update!(m, :content, stripForRSS) end)
|> Enum.sort_by(fn m -> Map.get(m, :date) end)
|> Enum.reverse()
|> Enum.map(fill_template_pretemplated.(post_feed_item_template))

@ -2,13 +2,8 @@
<title>{{title}}</title>
<link>https://raymon.dev/posts/{{localpath}}.html</link>
<guid>https://raymon.dev/posts/{{localpath}}.html</guid>
<description>
<![CDATA[
{{content}}
]]>
</description>
<content type="html">
{{content}}
</content>
<pubDate>{{date}}</pubDate>
<description><![CDATA[
{{content}}
]]></description>
</item>

@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="https://raymon.dev/posts/rss.xml" rel="self" type="application/rss+xml" />
<title>Posts</title>
<link>https://raymon.dev</link>
<title>Raymon Zutekouw</title>
<description>Personal blog</description>
<language>en-us</language>
<link>https://raymon.dev</link>
<atom:link href="https://raymon.dev/posts/rss.xml" rel="self" type="application/rss+xml" />
{{items}}
</channel>
</rss>

Loading…
Cancel
Save