diff --git a/src/main.rs b/src/main.rs
index facdfd8..4fcc1ac 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -59,8 +59,8 @@ struct IndexTemplate {
}
#[derive(Template)]
-#[template(path = "view_post.html")]
-struct ViewPostTemplate {
+#[template(path = "post.html")]
+struct PostTemplate {
meta: PostMetadata,
rendered: String,
rendered_in: RenderStats,
@@ -176,7 +176,7 @@ async fn post(State(state): State, Path(name): Path) -> AppRes
Ok(([("content-type", "text/plain")], buf).into_response())
} else {
let post = state.posts.get_post(&name).await?;
- let page = ViewPostTemplate {
+ let page = PostTemplate {
meta: post.0,
rendered: post.1,
rendered_in: post.2,
diff --git a/src/post/cache.rs b/src/post/cache.rs
index 6437aa3..89a598a 100644
--- a/src/post/cache.rs
+++ b/src/post/cache.rs
@@ -8,7 +8,7 @@ use crate::config::RenderConfig;
use crate::post::PostMetadata;
/// do not persist cache if this version number changed
-pub const CACHE_VERSION: u16 = 1;
+pub const CACHE_VERSION: u16 = 2;
#[derive(Serialize, Deserialize, Clone)]
pub struct CacheValue {
diff --git a/src/post/mod.rs b/src/post/mod.rs
index f62bb1e..1e2619f 100644
--- a/src/post/mod.rs
+++ b/src/post/mod.rs
@@ -5,7 +5,6 @@ use std::io;
use std::path::{Path, PathBuf};
use std::time::{Duration, Instant, SystemTime};
-use askama::Template;
use chrono::{DateTime, Utc};
use fronma::parser::{parse, ParsedData};
use serde::{Deserialize, Serialize};
@@ -63,14 +62,6 @@ pub struct PostMetadata {
pub tags: Vec,
}
-use crate::filters;
-#[derive(Template)]
-#[template(path = "post.html")]
-struct Post<'a> {
- pub meta: &'a PostMetadata,
- pub rendered_markdown: String,
-}
-
#[allow(unused)]
pub enum RenderStats {
Cached(Duration),
@@ -127,12 +118,7 @@ impl PostManager {
let parsing = parsing_start.elapsed();
let before_render = Instant::now();
- let rendered_markdown = render(body, &self.config);
- let post = Post {
- meta: &metadata,
- rendered_markdown,
- }
- .render()?;
+ let post = render(body, &self.config);
let rendering = before_render.elapsed();
if let Some(cache) = self.cache.as_ref() {
diff --git a/templates/post.html b/templates/post.html
index d148e5f..a4ddf62 100644
--- a/templates/post.html
+++ b/templates/post.html
@@ -1,16 +1,52 @@
{%- import "macros.askama" as macros -%}
-
- {{ meta.title }}
- - by {{ meta.author }}
-
-{{ meta.description }}
-
-
-
- {% call macros::table(meta) %}
-
- link
- back to home
-
-
-{{ rendered_markdown|escape("none") }}
+
+
+
+
+
+
+
+
+
+ {% match meta.icon %} {% when Some with (url) %}
+
+
+ {% when None %} {% endmatch %}
+ {{ meta.title }}
+
+
+
+
+
+
+
+ {{ meta.title }}
+ - by {{ meta.author }}
+
+ {{ meta.description }}
+
+
+ {{ rendered|escape("none") }}
+
+
+
+
+
diff --git a/templates/view_post.html b/templates/view_post.html
deleted file mode 100644
index e469da5..0000000
--- a/templates/view_post.html
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
- {% match meta.icon %} {% when Some with (url) %}
-
-
- {% when None %} {% endmatch %}
- {{ meta.title }}
-
-
-
-
-
- {{ rendered|escape("none") }}
-
-
-
-