Skip to main content

Module syndication

Module syndication 

Source
Expand description

RSS 2.0 and Atom 1.0 feed rendering. Build a syndication::Feed with channel metadata and syndication::FeedItems, then call syndication::render_rss or syndication::render_atom. RSS 2.0 and Atom 1.0 feeds.

Build a Feed and call render_rss or render_atom. Adding the route is up to you: serve the RSS string with Content-Type: application/rss+xml, the Atom one with application/atom+xml.

ⓘ
use rustango::syndication::{Feed, FeedItem, render_rss};
use chrono::Utc;

let feed = Feed {
    title: "Example blog".into(),
    link: "https://example.com/".into(),
    description: "Latest articles.".into(),
    language: Some("en".into()),
    items: vec![
        FeedItem::new("Hello, world", "https://example.com/articles/hello")
            .with_description("First post")
            .with_pub_date(Utc::now())
            .with_author("alice@example.com"),
    ],
};
let xml = render_rss(&feed);

Structs§

Feed
Feed-level metadata.
FeedItem
One entry in a feed.

Functions§

render_atom
Render an Atom 1.0 document.
render_rss
Render an RSS 2.0 document: one <channel> holding the metadata and the <item> elements.