aboutsummaryrefslogtreecommitdiff
path: root/code/src/html.rs
diff options
context:
space:
mode:
Diffstat (limited to 'code/src/html.rs')
-rw-r--r--code/src/html.rs31
1 files changed, 20 insertions, 11 deletions
diff --git a/code/src/html.rs b/code/src/html.rs
index bdc9a78..64b4c6d 100644
--- a/code/src/html.rs
+++ b/code/src/html.rs
@@ -1,4 +1,4 @@
-use crate::{article_metadata, get_articles, markdown::blocks_to_html};
+use crate::{article_metadata, get_articles, markdown::blocks_to_html, ArticleMeta};
use laby::{html, iter, li, ul, Render};
use std::fs::read_to_string;
@@ -9,7 +9,12 @@ pub fn scaffold(title: String, body: impl Render) -> impl Render {
title!(format!("{} - metamuffin's blog", title))
),
body!(
- nav!(h2!("metamuffin's blog"), a!(href = "./index.html", "index")),
+ nav!(
+ h2!("metamuffin's blog"),
+ a!(href = "./index.html", "index"),
+ " ",
+ a!(href = "./feed.atom", "atom")
+ ),
article!(body),
footer!(p!("written by metamuffin, licensed under CC-BY-ND-4.0"))
)
@@ -29,16 +34,20 @@ pub fn index(root: &str) -> impl Render {
scaffold(
"index".to_string(),
ul!(iter!({
- get_articles(&root).into_iter().map(|meta| {
- li!(
- meta.date.to_string(),
- ": ",
- a!(
- href = format!("./{}", meta.path.to_str().unwrap().replace(".md", ".html")),
- meta.title
+ get_articles(&root).into_iter().map(
+ |ArticleMeta {
+ canonical_name,
+ date,
+ title,
+ ..
+ }| {
+ li!(
+ date.to_string(),
+ ": ",
+ a!(href = format!("./{canonical_name}.html",), title)
)
- )
- })
+ },
+ )
})),
)
}