metamuffin's personal website


About 1695968345927 milliseconds have passed since midnight of the january the first in 1970.
------------------------------------------------------
use super::{
    helper::{get_articles, ArticleMeta},
    rocket_uri_macro_r_blog_article, rocket_uri_macro_r_blog_index, ARTICLE_ROOT,
};
use crate::{error::MyResult, uri};
use rocket::get;
use std::{path::PathBuf, str::FromStr};

#[get("/blog/feed.atom")]
pub async fn r_blog_atom() -> MyResult<String> {
    let entries = get_articles(&PathBuf::from_str(ARTICLE_ROOT).unwrap())
        .await?
        .iter()
        .map(
            |ArticleMeta {
                 title,
                 date,
                 canonical_name,
                 ..
             }| {
                let title = horrible_escape_function(title);
                let datetime = iso8601::DateTime {
                    date: date.clone(),
                    time: iso8601::Time::default(),
                };
                let href = uri!(r_blog_article(canonical_name));
                format!(
                    r#"
    <entry>
        <title>{title}</title>