From 9f3619e54a34701aa844c5a367c0fe275f93a857 Mon Sep 17 00:00:00 2001
From: Cotes Chung <11371340+cotes2020@users.noreply.github.com>
Date: Tue, 14 Jul 2020 21:32:01 +0800
Subject: [PATCH] Fixed last-mod display for non-English named posts.
---
_includes/panel.html | 2 +-
_layouts/post.html | 16 +++++++++++-----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/_includes/panel.html b/_includes/panel.html
index 99b6d4c..0a63a63 100644
--- a/_includes/panel.html
+++ b/_includes/panel.html
@@ -23,7 +23,7 @@
{% for item in update_list %}
- {% assign post_url = item | split: "::" | last | prepend: "/posts/" | append: "/" %}
+ {% assign post_url = item | split: "::" | last | url_encode | prepend: "/posts/" | append: "/" %}
{% assign post = site.posts | where: "url", post_url | first %}
{% if post %}
diff --git a/_layouts/post.html b/_layouts/post.html
index 9fc3c11..fac6d64 100644
--- a/_layouts/post.html
+++ b/_layouts/post.html
@@ -39,16 +39,22 @@ layout: default
{{ page.url | split: "/" | last }}
{%- endcapture -%}
- {% assign record = site.data.updates | where: "filename", filename | first %}
+ {% for item in site.data.updates %}
+ {% assign encode_filename = item.filename | url_encode %}
+ {% if filename == encode_filename %}
+ {% assign lastmod = item.lastmod %}
+ {% break %}
+ {% endif %}
+ {% endfor %}
- {% if record %}
+ {% if lastmod %}
Updated
- {{ record.lastmod | date: site.data.date_format.post }}
- {{ record.lastmod | date_to_xmlschema}}
+ title="{{ lastmod | date: site.data.date_format.tooltip }}">
+ {{ lastmod | date: site.data.date_format.post }}
+ {{ lastmod | date_to_xmlschema}}
{% endif %}