diff --git a/src/assets/rss.svg b/src/assets/rss.svg new file mode 100644 index 0000000000000000000000000000000000000000..a7f9cf196c5ad44579aeb152dc4b56b4b75c4c95 --- /dev/null +++ b/src/assets/rss.svg @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + id="RSSicon" + viewBox="0 0 8 8" width="256" height="256"> + + <title>RSS feed icon</title> + + <style type="text/css"> + .button {stroke: none; fill: orange;} + .symbol {stroke: none; fill: white;} + </style> + + <rect class="button" width="8" height="8" rx="1.5" /> + <circle class="symbol" cx="2" cy="6" r="1" /> + <path class="symbol" d="m 1,4 a 3,3 0 0 1 3,3 h 1 a 4,4 0 0 0 -4,-4 z" /> + <path class="symbol" d="m 1,2 a 5,5 0 0 1 5,5 h 1 a 6,6 0 0 0 -6,-6 z" /> + +</svg> \ No newline at end of file diff --git a/src/blog.rs b/src/blog.rs index 78ca55ad04a79f06c9b2884b2e27c5d6caea7f28..90a9a3fc71fbd150fb7d3b4f1910c5f24c7aeb7c 100644 --- a/src/blog.rs +++ b/src/blog.rs @@ -47,7 +47,7 @@ impl Blog { let description = &self.config.description; let mut content = format!( - r#"<div class="centered"><h1>{name}</h1>{description}</div><h2>Recent Posts</h2><table>"# + r#"<div class="centered"><h1>{name}</h1>{description}</div><h2>Recent Posts <a href="/posts.rss"><img src="/rss.svg" width="16em" /></a></h2><table>"# ); for post in &self.posts { @@ -168,6 +168,11 @@ impl TryFrom<Blog> for RenderedBlog { } insert_path(&mut pages, "/posts.rss", Response::rss(b.rss()?))?; + insert_path( + &mut pages, + "/rss.svg", + Response::svg(include_bytes!("assets/rss.svg").to_vec()), + )?; let not_found = Response::html(b.dress_page(Some("Page not found"), include_str!("assets/404.html"))); diff --git a/src/resp.rs b/src/resp.rs index e6c3aea739d7ac7373e6b6883427d1022fcf4407..f3806c594b28ae2319a9924643268aced30b1459 100644 --- a/src/resp.rs +++ b/src/resp.rs @@ -64,4 +64,12 @@ impl Response { data, } } + + pub fn svg(data: Vec<u8>) -> Self { + Self { + content_type: "image/svg+xml", + expiry: Expiry::Year, + data, + } + } }