404: add page
This commit is contained in:
parent
6325e0568c
commit
c4c49dee6b
6 changed files with 43 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
use agahnim_web_v2::templates::index::home;
|
use agahnim_web_v2::templates::{index::home, notfound::notfound};
|
||||||
use axum::{Router, routing::get};
|
use axum::{Router, routing::get};
|
||||||
use tower_http::services::ServeDir;
|
use tower_http::services::ServeDir;
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
|
|
@ -8,7 +8,8 @@ use tower_livereload::LiveReloadLayer;
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.route("/", get(home))
|
.route("/", get(home))
|
||||||
.nest_service("/static", ServeDir::new("static"));
|
.nest_service("/static", ServeDir::new("static"))
|
||||||
|
.fallback(notfound);
|
||||||
|
|
||||||
// We need to include this flag so that the live reload layer isn't included when the server is built
|
// We need to include this flag so that the live reload layer isn't included when the server is built
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
pub mod index;
|
pub mod index;
|
||||||
|
pub mod notfound;
|
||||||
|
|
|
||||||
10
src/templates/notfound.rs
Normal file
10
src/templates/notfound.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
use askama::Template;
|
||||||
|
use axum::response::{Html, IntoResponse};
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(path = "notfound.html")]
|
||||||
|
struct NotfoundTemplate;
|
||||||
|
|
||||||
|
pub async fn notfound() -> impl IntoResponse {
|
||||||
|
Html(NotfoundTemplate.render().unwrap())
|
||||||
|
}
|
||||||
BIN
static/assets/images/notfound.webp
Normal file
BIN
static/assets/images/notfound.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
|
|
@ -81,3 +81,23 @@ home-content {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 404 */
|
||||||
|
katcenkat {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
img {
|
||||||
|
transition: opacity 5s ease, transform 5s ease-out;
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0px);
|
||||||
|
|
||||||
|
@starting-style {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(500px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
templates/notfound.html
Normal file
9
templates/notfound.html
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<katcenkat>
|
||||||
|
<img src="/static/assets/images/notfound.webp" />
|
||||||
|
<img src="/static/assets/images/leuf.webp" />
|
||||||
|
</katcenkat>
|
||||||
|
{% endblock %}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue