+17
-11
@@ -1,6 +1,8 @@
|
||||
use askama::Template;
|
||||
use axum::{
|
||||
extract::{OriginalUri, Path},
|
||||
http::StatusCode,
|
||||
response::{Html, IntoResponse},
|
||||
};
|
||||
use tokio::try_join;
|
||||
use tracing::debug;
|
||||
@@ -22,7 +24,7 @@ use super::post_list::PostListTemplate;
|
||||
pub async fn render_blog_post_list(
|
||||
tag: Option<Path<String>>,
|
||||
OriginalUri(original_uri): OriginalUri,
|
||||
) -> Result<PostListTemplate, StatusCode> {
|
||||
) -> Result<impl IntoResponse, StatusCode> {
|
||||
// I will forget what happens here in a week. But essentially it's pattern matching and shadowing
|
||||
let tag = tag.map(|Path(tag)| tag);
|
||||
|
||||
@@ -50,14 +52,18 @@ pub async fn render_blog_post_list(
|
||||
("Blog posts".to_string(), "Blog posts".to_string())
|
||||
};
|
||||
|
||||
Ok(PostListTemplate {
|
||||
title,
|
||||
og_title,
|
||||
segment: Segment::Blog,
|
||||
posts,
|
||||
header_props,
|
||||
tags: blog_tags,
|
||||
featured_projects,
|
||||
current_url: original_uri.to_string(),
|
||||
})
|
||||
Ok(Html(
|
||||
PostListTemplate {
|
||||
title,
|
||||
og_title,
|
||||
segment: Segment::Blog,
|
||||
posts,
|
||||
header_props,
|
||||
tags: blog_tags,
|
||||
featured_projects,
|
||||
current_url: original_uri.to_string(),
|
||||
}
|
||||
.render()
|
||||
.unwrap(),
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user