From b3f7737735092ba14e5dcc2a38b45e199dd069cc Mon Sep 17 00:00:00 2001 From: Adrian Hedqvist Date: Mon, 3 Apr 2023 23:49:16 +0200 Subject: [PATCH] fix tag feed rel link --- src/handlers/tags.rs | 7 ++++--- templates/partials/head.html | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/handlers/tags.rs b/src/handlers/tags.rs index d72b6df..5916214 100644 --- a/src/handlers/tags.rs +++ b/src/handlers/tags.rs @@ -22,14 +22,14 @@ pub fn router() -> Router> { } #[derive(Serialize, Debug)] -struct PageContext<'a> { +struct TagContext<'a> { title: &'a str, } #[instrument(skip(state))] pub async fn index(State(state): State>) -> Result, WebsiteError> { let tags: Vec<_> = state.tags.values().collect(); - let ctx = PageContext { title: "Tags" }; + let ctx = TagContext { title: "Tags" }; let mut c = tera::Context::new(); c.insert("page", &ctx); @@ -56,9 +56,10 @@ pub async fn view( let title = format!("Posts tagged with #{tag}"); - let ctx = PageContext { title: &title }; + let ctx = TagContext { title: &title }; let mut c = tera::Context::new(); + c.insert("tag_slug", &tag); c.insert("page", &ctx); c.insert("posts", &posts); diff --git a/templates/partials/head.html b/templates/partials/head.html index 8891201..b9d49fe 100644 --- a/templates/partials/head.html +++ b/templates/partials/head.html @@ -3,8 +3,8 @@ - {% if tag -%} - + {% if tag_slug -%} + {%- endif %}