Fetch and save entry HTML content with metadata

And render the extracted HTML on the entry page in the frontend.
This commit is contained in:
2023-06-07 01:06:03 -04:00
parent 786f3a194f
commit 3f29138bd1
7 changed files with 516 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
use axum::extract::{State, Path};
use axum::response::Response;
use maud::html;
use maud::{html, PreEscaped};
use sqlx::PgPool;
use crate::error::Result;
@@ -12,7 +12,7 @@ pub async fn get(Path(id): Path<i32>, State(pool): State<PgPool>, layout: Layout
Ok(layout.render(html! {
@let title = entry.title.unwrap_or_else(|| "Untitled".to_string());
h1 { a href=(entry.url) { (title) } }
@let description = entry.description.unwrap_or_else(|| "No description".to_string());
p { (description) }
@let content = entry.html_content.unwrap_or_else(|| "No content".to_string());
(PreEscaped(content))
}))
}