dillonkearns / elm-rss / Rss

Build a feed following the RSS 2.0 format https://validator.w3.org/feed/docs/rss2.html. http://www.rssboard.org/rss-specification

generate : { title : String, description : String, url : String, lastBuildTime : Time.Posix, generator : Maybe String, items : List Item, siteUrl : String } -> String

Generate an RSS feed from feed metadata and a list of Rss.Items.


type alias Item =
{ title : String
, description : String
, url : String
, categories : List String
, author : String
, pubDate : DateOrTime
, content : Maybe String
, contentEncoded : Maybe String
, enclosure : Maybe { url : String
, mimeType : String
, bytes : Maybe Basics.Int } 
}

Data representing an RSS feed item.

contentEncoded - Use this to add HTML content in a <content:encoded> tag in the RSS feed. Some feed readers will use this field if present to render HTML. Note that Elm doesn't provide a way to turn Html.Html values into a String.

You can use zwilias/elm-html-string to render HTML using a drop-in replacement API and then turn that into a String.

Here's an example that shows how to render to an HTML String using dillonkearns/elm-markdown.

https://demo.ghost.io/author/lewis/rss/

Encoding

enclosure - link to an attached file

https://www.rssboard.org/rss-enclosures-use-case


type DateOrTime
    = Date Date
    | DateTime Time.Posix

Can be one of:

If you pass in an Rss.Date, it will format it at 00:00:00 GMT on the given date (start of day). If you pass in an Rss.DateTime, it will format the time in UTC.


type alias Enclosure =
{ url : String
, mimeType : String
, bytes : Maybe Basics.Int 
}

Represents a linked file.

https://validator.w3.org/feed/docs/rss2.html#ltenclosuregtSubelementOfLtitemgt