| 1 | import gleam/time/timestamp |
| 2 | import webls/sitemap |
| 3 | import webls/rss |
| 4 | import webls/robots |
| 5 | |
| 6 | pub fn sitemap() -> String { |
| 7 | sitemap.sitemap("https://gleam.run/sitemap.xml") |
| 8 | |> sitemap.with_sitemap_last_modified(timestamp.system_time()) |
| 9 | |> sitemap.with_sitemap_items([ |
| 10 | sitemap.item("https://gleam.run") |
| 11 | |> sitemap.with_item_frequency(sitemap.Monthly) |
| 12 | |> sitemap.with_item_priority(1.0), |
| 13 | sitemap.item("https://gleam.run/blog") |
| 14 | |> sitemap.with_item_frequency(sitemap.Weekly), |
| 15 | sitemap.item("https://gleam.run/blog/gleam-1.0"), |
| 16 | sitemap.item("https://gleam.run/blog/gleam-1.1"), |
| 17 | ]) |> sitemap.to_string() |
| 18 | } |
| 19 | |
| 20 | pub fn rss() -> String { |
| 21 | [ |
| 22 | rss.channel("Gleam RSS", "A test RSS feed", "https://gleam.run") |
| 23 | |> rss.with_channel_category("Releases") |
| 24 | |> rss.with_channel_language("en") |
| 25 | |> rss.with_channel_items([ |
| 26 | rss.item("Gleam 1.0", "Gleam 1.0 is here!") |
| 27 | |> rss.with_item_link("https://gleam.run/blog/gleam-1.0") |
| 28 | |> rss.with_item_pub_date(timestamp.system_time()) |
| 29 | |> rss.with_item_guid(#("gleam 1.0", Some(False))), |
| 30 | rss.item("Gleam 0.10", "Gleam 0.10 is here!") |
| 31 | |> rss.with_item_link("https://gleam.run/blog/gleam-0.10") |
| 32 | |> rss.with_item_author("user@example.com") |
| 33 | |> rss.with_item_guid(#("gleam 0.10", Some(True))), |
| 34 | ]), |
| 35 | ] |> rss.to_string() |
| 36 | } |
| 37 | |
| 38 | pub fn robots() -> String { |
| 39 | robots.config("https://example.com/sitemap.xml") |
| 40 | |> robots.with_config_robots([ |
| 41 | robots.robot("googlebot") |
| 42 | |> robots.with_robot_allowed_routes(["/posts/", "/contact/"]) |
| 43 | |> robots.with_robot_disallowed_routes(["/admin/", "/private/"]), |
| 44 | robots.robot("bingbot") |
| 45 | |> robots.with_robot_allowed_routes(["/posts/", "/contact/", "/private/"]) |
| 46 | |> robots.with_robot_disallowed_routes(["/"]), |
| 47 | ]) |
| 48 | |> robots.to_string() |
| 49 | } |