From 9e146a04c60ef8b8e350aead162d251e45820bdd Mon Sep 17 00:00:00 2001 From: Jesse Wei Date: Sat, 10 Jun 2023 21:43:31 -0400 Subject: [PATCH] Make latest post redirect if the blog post redirects (#1451) Fixes #1450, and the behavior of the site with this "new" code is shown in the Expected behavior screenshots there. I copy-pasted the redirect logic from `blog/index.html` into `_includes/latest_posts.html`, with minor name changes. I also cleaned up a line in `blog/index.html`. --- _includes/latest_posts.html | 11 ++++++++++- blog/index.html | 16 +++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/_includes/latest_posts.html b/_includes/latest_posts.html index 91514d7..bb82acb 100644 --- a/_includes/latest_posts.html +++ b/_includes/latest_posts.html @@ -14,7 +14,16 @@ {{ item.date | date: "%b %-d, %Y" }} - {{ item.title }} + {% if item.redirect == blank %} + {{ item.title }} + {% elsif item.redirect contains '://' %} + {{ item.title }} + + + + {% else %} + {{ item.title }} + {% endif %} {%- endfor %} diff --git a/blog/index.html b/blog/index.html index f6cebe9..ad629b2 100644 --- a/blog/index.html +++ b/blog/index.html @@ -59,16 +59,14 @@ pagination: {%- endif -%}

{% if post.redirect == blank %} - {{ post.title }} + {{ post.title }} + {% elsif post.redirect contains '://' %} + {{ post.title }} + + + {% else %} - {% if post.redirect contains '://' %} - {{ post.title }} - - - - {% else %} - {{ post.title }} - {% endif %} + {{ post.title }} {% endif %}

{{ post.description }}