From 2d9ce75ec0039cb62d37276ad15b76d875510f12 Mon Sep 17 00:00:00 2001 From: gered Date: Sat, 1 Jul 2023 16:19:22 -0400 Subject: [PATCH] add separate template for the "latest post" page (the home/main page) since it's reasonable to assume some may want to customize this a little differently than the normal post page. --- example-site/templates/latest_post.html | 4 ++++ src/site.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 example-site/templates/latest_post.html diff --git a/example-site/templates/latest_post.html b/example-site/templates/latest_post.html new file mode 100644 index 0000000..0d57eec --- /dev/null +++ b/example-site/templates/latest_post.html @@ -0,0 +1,4 @@ +{% extends "base.html" %} +{% block content %} +{% include "partials/post.html" %} +{% endblock content %} \ No newline at end of file diff --git a/src/site.rs b/src/site.rs index 0c5623f..e41f367 100644 --- a/src/site.rs +++ b/src/site.rs @@ -343,7 +343,7 @@ impl SiteService { if let Some(post) = post { context.insert("post", post); } - HttpResponse::Ok().body(self.template_renderer.render("post.html", &context).unwrap()) + HttpResponse::Ok().body(self.template_renderer.render("latest_post.html", &context).unwrap()) } pub fn serve_posts_by_tag(&self, tag: &Tag) -> HttpResponse {