aboutsummaryrefslogtreecommitdiff
path: root/code/src/html.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-08-29 23:19:49 +0200
committermetamuffin <metamuffin@disroot.org>2022-08-29 23:19:49 +0200
commit9fba4dc45d7319d03584fe10ead95d0ff7974234 (patch)
tree5cb8882a51864b10ac788c9bedfeb72b4ff37e21 /code/src/html.rs
parent3830096c748bd26c8c2aeb906e8e63960f240567 (diff)
downloadmetamuffin-blog-9fba4dc45d7319d03584fe10ead95d0ff7974234.tar
metamuffin-blog-9fba4dc45d7319d03584fe10ead95d0ff7974234.tar.bz2
metamuffin-blog-9fba4dc45d7319d03584fe10ead95d0ff7974234.tar.zst
more bugs
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)
)
- )
- })
+ },
+ )
})),
)
}