Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/versecafe/webls
A Gleam library for generating sitemaps, rss feeds, and more!
https://github.com/versecafe/webls
Last synced: 16 days ago
JSON representation
A Gleam library for generating sitemaps, rss feeds, and more!
- Host: GitHub
- URL: https://github.com/versecafe/webls
- Owner: versecafe
- License: apache-2.0
- Created: 2024-08-09T02:55:01.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-09-12T02:04:07.000Z (5 months ago)
- Last Synced: 2024-12-30T23:44:33.518Z (about 1 month ago)
- Language: Gleam
- Size: 40 KB
- Stars: 12
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WebLS
A Gleam library for generating sitemaps and RSS feeds and more. to meet all
your common web listing needs.[![Package Version](https://img.shields.io/hexpm/v/webls)](https://hex.pm/packages/webls)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/webls/)```sh
gleam add webls
``````gleam
import webls/sitemap
import webls/rss
import webls/robotspub fn sitemap() -> String {
sitemap.sitemap("https://gleam.run/sitemap.xml")
|> sitemap.with_sitemap_last_modified(birl.now())
|> sitemap.with_sitemap_items([
sitemap.item("https://gleam.run")
|> sitemap.with_item_frequency(sitemap.Monthly)
|> sitemap.with_item_priority(1.0),
sitemap.item("https://gleam.run/blog")
|> sitemap.with_item_frequency(sitemap.Weekly),
sitemap.item("https://gleam.run/blog/gleam-1.0"),
sitemap.item("https://gleam.run/blog/gleam-1.1"),
]) |> sitemap.to_string()
}pub fn rss() -> String {
[
rss.channel("Gleam RSS", "A test RSS feed", "https://gleam.run")
|> rss.with_channel_category("Releases")
|> rss.with_channel_language("en")
|> rss.with_channel_items([
rss.item("Gleam 1.0", "Gleam 1.0 is here!")
|> rss.with_item_link("https://gleam.run/blog/gleam-1.0")
|> rss.with_item_pub_date(birl.now())
|> rss.with_item_guid(#("gleam 1.0", Some(False))),
rss.item("Gleam 0.10", "Gleam 0.10 is here!")
|> rss.with_item_link("https://gleam.run/blog/gleam-0.10")
|> rss.with_item_author("[email protected]")
|> rss.with_item_guid(#("gleam 0.10", Some(True))),
]),
] |> rss.to_string()
}pub fn robots() -> String {
robots.config("https://example.com/sitemap.xml")
|> robots.with_config_robots([
robots.robot("googlebot")
|> robots.with_robot_allowed_routes(["/posts/", "/contact/"])
|> robots.with_robot_disallowed_routes(["/admin/", "/private/"]),
robots.robot("bingbot")
|> robots.with_robot_allowed_routes(["/posts/", "/contact/", "/private/"])
|> robots.with_robot_disallowed_routes(["/"]),
])
|> robots.to_string()
}
```Further documentation can be found at .
## Current Standards Compliance
| Protocol | Version | Status |
| ---------- | -------- | -------- |
| Sitemaps | 0.9 | Complete |
| RSS | 2.0.1 | Complete |
| Robots.txt | 1997 IDS | Complete |
| Atom | 1.0 | Complete |> A Note on the RSS 2.0 spec, the PICS field for content ratings is not going
> to be supported as the PICS standard was discontinued more than a decade ago.## Utility Support
| Type | to_string | Builder Functions | Validators |
| ---------- | --------- | ----------------- | ---------- |
| Sitemap | Complete | Complete | None |
| RSS v2.0 | Complete | Complete | None |
| Robots.txt | Complete | Complete | None |
| Atom | Complete | Complete | None |## Development
```sh
gleam run # Run the project
gleam test # Run the tests
```> Yes the name is a reference to the `ls` command in unix to list files