Compare commits

...

2 Commits

Author SHA1 Message Date
kirbylife f793227b82 Add Rocket.toml config file 2024-02-20 00:59:28 -06:00
kirbylife f45a8e354d Fix 404 handler 2024-02-20 00:59:15 -06:00
3 changed files with 8 additions and 5 deletions

3
.gitignore vendored
View File

@ -7,3 +7,6 @@ Cargo.lock
# Geany proyect config # Geany proyect config
proyectos proyectos
# Rocket Config
Rocket.toml

View File

@ -53,14 +53,14 @@ impl SinglePost {
#[derive(Serialize)] #[derive(Serialize)]
pub struct NotFound { pub struct NotFound {
title: String, title: String,
uri: String, url: String,
} }
impl NotFound { impl NotFound {
pub fn new(uri: String) -> Self { pub fn new(url: String) -> Self {
NotFound { NotFound {
title: gen_title(), title: gen_title(),
uri, url,
} }
} }
} }

View File

@ -98,9 +98,9 @@ fn show_post(title: String) -> Template {
Template::render("post", context) Template::render("post", context)
} }
Err(_) => { Err(_) => {
let uri = format!("/post/{}", title_splited.join("-")); let url = format!("/post/{}", title_splited.join("-"));
let context = contexts::NotFound::new(uri); let context = contexts::NotFound::new(url);
Template::render("404", context) Template::render("404", context)
} }