better 404 page

This commit is contained in:
Mylloon 2023-02-09 10:55:49 +01:00
parent 43c4c9626d
commit 23774abc1b
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 54 additions and 1 deletions

View file

@ -1,5 +1,16 @@
use actix_web::{HttpResponse, Responder};
use askama::Template;
pub async fn page() -> impl Responder {
HttpResponse::NotFound().body("404 :/")
HttpResponse::NotFound().body(get_page())
}
#[derive(Template)]
#[template(path = "../templates/404.html")]
struct Error404Template {}
pub fn get_page() -> std::string::String {
let index = Error404Template {};
index.render().unwrap()
}

42
templates/404.html Normal file
View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html class="index" lang="fr">
<head dir="rtl">
<title>Erreur 404</title>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=0.01" />
<link rel="stylesheet" href="css/style.css" />
<meta name="author" content="Mylloon" />
<meta name="description" content="Page principale" />
<link
rel="apple-touch-icon"
sizes="180x180"
href="icons/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="icons/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="icons/favicon-16x16.png"
/>
<link rel="manifest" href="icons/site.webmanifest" />
<link rel="mask-icon" href="icons/safari-pinned-tab.svg" color="#5bbad5" />
<link rel="shortcut icon" href="icons/favicon.ico" />
<meta name="msapplication-TileColor" content="#ffffff" />
<meta name="msapplication-config" content="icons/browserconfig.xml" />
<meta name="theme-color" content="#2a2424" />
<meta content="Anri - Mylloon" property="og:title" />
<meta content="Page principale" property="og:description" />
<meta content="icons/apple-touch-icon.png" property="og:image" />
<meta content="#43B581" data-react-helmet="true" name="theme-color" />
</head>
<body class="index">
<p style="color: aliceblue">404 :/</p>
</body>
</html>