This commit is contained in:
@ -1,4 +1,3 @@
|
||||
use askama::Template;
|
||||
use axum::{
|
||||
extract::{OriginalUri, Path},
|
||||
http::StatusCode,
|
||||
@ -7,28 +6,16 @@ use tokio::try_join;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::{
|
||||
blog_posts::{
|
||||
blog_post_model::{BlogPostMetadata, BLOG_POST_PATH},
|
||||
tag_list::{get_popular_tags, get_posts_by_tag},
|
||||
},
|
||||
blog_posts::blog_post_model::{BlogPostMetadata, BLOG_POST_PATH},
|
||||
components::site_header::{HeaderProps, Link},
|
||||
filters,
|
||||
post_utils::{post_listing::get_post_list, post_parser::ParseResult},
|
||||
projects::{featured_projects::get_featured_projects, project_model::ProjectMetadata},
|
||||
post_utils::{
|
||||
post_listing::get_post_list,
|
||||
tags::{get_popular_tags, get_posts_by_tag},
|
||||
},
|
||||
projects::featured_projects::get_featured_projects,
|
||||
};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "blog_post_list.html")]
|
||||
pub struct PostListTemplate {
|
||||
pub title: String,
|
||||
pub og_title: String,
|
||||
pub segment: String,
|
||||
pub posts: Vec<ParseResult<BlogPostMetadata>>,
|
||||
pub header_props: HeaderProps,
|
||||
pub tags: Vec<String>,
|
||||
pub featured_projects: Vec<ParseResult<ProjectMetadata>>,
|
||||
pub current_url: String,
|
||||
}
|
||||
use super::post_list::PostListTemplate;
|
||||
|
||||
pub async fn render_blog_post_list(
|
||||
tag: Option<Path<String>>,
|
||||
|
@ -6,16 +6,16 @@ use tokio::try_join;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::{
|
||||
blog_posts::{
|
||||
blog_post_model::{BlogPostMetadata, BLOG_POST_PATH},
|
||||
tag_list::{get_popular_tags, get_posts_by_tag},
|
||||
},
|
||||
blog_posts::blog_post_model::{BlogPostMetadata, BLOG_POST_PATH},
|
||||
components::site_header::{HeaderProps, Link},
|
||||
post_utils::post_listing::get_post_list,
|
||||
post_utils::{
|
||||
post_listing::get_post_list,
|
||||
tags::{get_popular_tags, get_posts_by_tag},
|
||||
},
|
||||
projects::featured_projects::get_featured_projects,
|
||||
};
|
||||
|
||||
use super::blog_post_list::PostListTemplate;
|
||||
use super::post_list::PostListTemplate;
|
||||
|
||||
pub async fn render_broadcast_post_list(
|
||||
tag: Option<Path<String>>,
|
||||
|
@ -3,13 +3,10 @@ use axum::http::StatusCode;
|
||||
use tokio::try_join;
|
||||
|
||||
use crate::{
|
||||
blog_posts::{
|
||||
blog_post_model::BlogPostMetadata, featured_blog_posts::get_featured_blog_posts,
|
||||
tag_list::get_popular_tags,
|
||||
},
|
||||
blog_posts::{blog_post_model::BlogPostMetadata, featured_blog_posts::get_featured_blog_posts},
|
||||
components::site_header::HeaderProps,
|
||||
filters,
|
||||
post_utils::post_parser::ParseResult,
|
||||
post_utils::{post_parser::ParseResult, tags::get_popular_tags},
|
||||
projects::{featured_projects::get_featured_projects, project_model::ProjectMetadata},
|
||||
};
|
||||
|
||||
|
@ -4,5 +4,7 @@ pub mod blog_post_page;
|
||||
pub mod broadcast_list;
|
||||
pub mod contact;
|
||||
pub mod index;
|
||||
pub mod not_found;
|
||||
pub mod post_list;
|
||||
pub mod project_list;
|
||||
pub mod showcase;
|
||||
|
25
src/pages/not_found.rs
Normal file
25
src/pages/not_found.rs
Normal file
@ -0,0 +1,25 @@
|
||||
use askama::Template;
|
||||
use axum::{extract::OriginalUri, http::StatusCode};
|
||||
use tracing::info;
|
||||
|
||||
use crate::components::site_header::HeaderProps;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "not_found.html")]
|
||||
pub struct NotFoundPage {
|
||||
title: String,
|
||||
header_props: HeaderProps,
|
||||
}
|
||||
|
||||
pub async fn render_not_found(
|
||||
OriginalUri(original_uri): OriginalUri,
|
||||
) -> Result<(StatusCode, NotFoundPage), StatusCode> {
|
||||
info!("{original_uri} not found");
|
||||
Ok((
|
||||
StatusCode::NOT_FOUND,
|
||||
NotFoundPage {
|
||||
title: "This page does not exists".to_owned(),
|
||||
header_props: HeaderProps::default(),
|
||||
},
|
||||
))
|
||||
}
|
19
src/pages/post_list.rs
Normal file
19
src/pages/post_list.rs
Normal file
@ -0,0 +1,19 @@
|
||||
use askama::Template;
|
||||
|
||||
use crate::{
|
||||
blog_posts::blog_post_model::BlogPostMetadata, components::site_header::HeaderProps, filters,
|
||||
post_utils::post_parser::ParseResult, projects::project_model::ProjectMetadata,
|
||||
};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "post_list.html")]
|
||||
pub struct PostListTemplate {
|
||||
pub title: String,
|
||||
pub og_title: String,
|
||||
pub segment: String,
|
||||
pub posts: Vec<ParseResult<BlogPostMetadata>>,
|
||||
pub header_props: HeaderProps,
|
||||
pub tags: Vec<String>,
|
||||
pub featured_projects: Vec<ParseResult<ProjectMetadata>>,
|
||||
pub current_url: String,
|
||||
}
|
Reference in New Issue
Block a user