diff --git a/src/handlers/home.rs b/src/handlers/home.rs index d88bac3..8fc864a 100644 --- a/src/handlers/home.rs +++ b/src/handlers/home.rs @@ -1,16 +1,18 @@ use rocket::State; use rocket_contrib::Template; use std::collections::HashMap; +use super::super::Config; use super::super::NoteStore; #[derive(Serialize)] struct IndexTemplateContext<'a> { app_version: &'a str, notes: Vec>, + title: String, } #[get("/")] -fn index(notes: State) -> Template { +fn index(notes: State, config: State) -> Template { let notes = notes.read().unwrap(); let mut note_kvs = vec![]; for note in notes.iter() { @@ -22,6 +24,7 @@ fn index(notes: State) -> Template { let context = IndexTemplateContext { app_version: env!("CARGO_PKG_VERSION"), notes: note_kvs, + title: config.title.clone(), }; Template::render("index", &context) } diff --git a/templates/_layout.html.tera b/templates/_layout.html.tera index 40fc1da..fd5c69a 100644 --- a/templates/_layout.html.tera +++ b/templates/_layout.html.tera @@ -5,7 +5,7 @@ - {% block title %}Online Prikbord Familie van Tilburg{% endblock title %} + {% block title %}{{ title }}{% endblock title %} @@ -34,7 +34,7 @@ {% block body %}