Simple RSS feed builder for Elixir
To add rss
to your mix project dependencies just edit your mix.exs
defp deps do
[ # your other dependencies (hint: mind the commas)
{ :rss, "~> 0.2.1" }
]
end
and to download and compile it run:
mix do deps.get, compile
RSS provides 3 simple functions for building RSS feeds
To create the channel section, use RSS.channel/5
channel = RSS.channel("Title", "http://link.to.site", "Description", "Date in RFC 1123 or RFC 882 format", "en-us")
You only need to do this once. From here on in, you can create items using RSS.item/5
.
item = RSS.item("Title", "Description", "Date in RFC 1123 or RFC 882 format", "http://link.to.site/post", "guid-1234-aa"
Once you have a list of items, in a variable names items
perhaps, you can build the full feed by using RSS.feed/2
feed = RSS.feed(channel, items)
Research for the feed format came from this blog post
Validate your RSS using the W3C feed validator