diff --git a/src/routes/blog.rs b/src/routes/blog.rs index 1908fe0..1d99d47 100644 --- a/src/routes/blog.rs +++ b/src/routes/blog.rs @@ -14,7 +14,14 @@ pub async fn index(config: web::Data) -> impl Responder { #[derive(Content)] struct BlogIndexTemplate { - posts: Option>, + posts: Option>, +} + +#[derive(Content)] +struct Post { + title: String, + url: String, + file: File, } #[once(time = 60)] diff --git a/templates/blog/index.html b/templates/blog/index.html index 60d353a..7fec9ce 100644 --- a/templates/blog/index.html +++ b/templates/blog/index.html @@ -2,7 +2,17 @@ {{>head.html}} -

Index

- {{>footer.html}} + {{#data}} +

Blog

+
+ {{^posts}} +

Aucun posts

+ {{/posts}} {{#posts}} +

+ {{title}} +

+ {{/posts}} +
+ {{/data}} {{>footer.html}}