A Gleam library for generating sitemaps and RSS feeds and more. to meet all your common web listing needs.
| 1 | gleam add webls@1 |
| 1 | import webls/rss.{RssChannel, RssItem} |
| 2 | |
| 3 | pub fn generate_rss_feed() -> String { |
| 4 | let channels = [ |
| 5 | RssChannel( |
| 6 | title: "Gleam RSS", |
| 7 | description: "A test RSS feed", |
| 8 | link: "https://gleam.run", |
| 9 | items: [ |
| 10 | RssItem( |
| 11 | title: "Gleam 1.0", |
| 12 | link: "https://gleam.run/blog/gleam-1.0", |
| 13 | description: "Gleam 1.0 is here!", |
| 14 | pub_date: birl.now(), |
| 15 | author: None, |
| 16 | guid: #("gleam.run", Some(True)), |
| 17 | ), |
| 18 | RssItem( |
| 19 | title: "Gleam 0.10", |
| 20 | link: "https://gleam.run/blog/gleam-0.10", |
| 21 | description: "Gleam 0.10 is here!", |
| 22 | pub_date: birl.now(), |
| 23 | author: Some("user@example.com"), |
| 24 | guid: #("gleam.run", Some(True)), |
| 25 | ), |
| 26 | ], |
| 27 | ), |
| 28 | ] |
| 29 | |
| 30 | channels |
| 31 | |> rss.to_string() |
| 32 | } |
Further documentation can be found at https://hexdocs.pm/webls.
| 1 | gleam run # Run the project |
| 2 | gleam test # Run the tests |
Yes the name is a reference to the
lscommand in unix to list files