This commit is contained in:
parent
eadf06c745
commit
8c615338e5
2 changed files with 20 additions and 3 deletions
|
@ -14,7 +14,14 @@ pub async fn index(config: web::Data<Config>) -> impl Responder {
|
|||
|
||||
#[derive(Content)]
|
||||
struct BlogIndexTemplate {
|
||||
posts: Option<Vec<File>>,
|
||||
posts: Option<Vec<Post>>,
|
||||
}
|
||||
|
||||
#[derive(Content)]
|
||||
struct Post {
|
||||
title: String,
|
||||
url: String,
|
||||
file: File,
|
||||
}
|
||||
|
||||
#[once(time = 60)]
|
||||
|
|
|
@ -2,7 +2,17 @@
|
|||
<html class="index" lang="fr">
|
||||
{{>head.html}}
|
||||
<body class="index">
|
||||
<p style="color: aliceblue">Index</p>
|
||||
{{>footer.html}}
|
||||
{{#data}}
|
||||
<h1 id="title">Blog</h1>
|
||||
<div id="content">
|
||||
{{^posts}}
|
||||
<h2 class="subtitle">Aucun posts</h2>
|
||||
{{/posts}} {{#posts}}
|
||||
<h2 class="subtitle">
|
||||
<a target="_self" href="/blog/{{url}}">{{title}}</a>
|
||||
</h2>
|
||||
{{/posts}}
|
||||
</div>
|
||||
{{/data}} {{>footer.html}}
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue