post now available on /p
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending

This commit is contained in:
Mylloon 2023-04-26 10:41:49 +02:00
parent 2e2dc13d43
commit 39fde5225d
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 3 additions and 3 deletions

View file

@ -118,12 +118,12 @@ struct BlogPostTemplate {
post: Option<File>, post: Option<File>,
} }
#[get("/blog/{id}")] #[get("/blog/p/{id}")]
pub async fn page(path: web::Path<(String,)>, config: web::Data<Config>) -> impl Responder { pub async fn page(path: web::Path<(String,)>, config: web::Data<Config>) -> impl Responder {
HttpResponse::Ok().body(build_post(path.into_inner().0, config.get_ref().to_owned())) HttpResponse::Ok().body(build_post(path.into_inner().0, config.get_ref().to_owned()))
} }
pub fn build_post(file: String, config: Config) -> String { fn build_post(file: String, config: Config) -> String {
let mut post = None; let mut post = None;
let infos = get_post(&mut post, file); let infos = get_post(&mut post, file);

View file

@ -14,7 +14,7 @@
<div class="timeline"> <div class="timeline">
<ul> <ul>
{{#posts}} {{#posts}}
<li onclick="location.href='/blog/{{url}}';"> <li onclick="location.href='/blog/p/{{url}}';">
{{>blog/date.html}} {{>blog/date.html}}
<div class="content"> <div class="content">
<h2>{{title}}</h2> <h2>{{title}}</h2>