Fixed last-mod display for non-English named posts.

This commit is contained in:
Cotes Chung 2020-07-14 21:32:01 +08:00
parent 5b0aaa5403
commit 9f3619e54a
2 changed files with 12 additions and 6 deletions

View file

@ -23,7 +23,7 @@
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
{% 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 %}

View file

@ -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 %}
<div>
Updated
<span class="timeago lastmod"
data-toggle="tooltip" data-placement="bottom"
title="{{ record.lastmod | date: site.data.date_format.tooltip }}">
{{ record.lastmod | date: site.data.date_format.post }}
<i class="unloaded">{{ record.lastmod | date_to_xmlschema}}</i>
title="{{ lastmod | date: site.data.date_format.tooltip }}">
{{ lastmod | date: site.data.date_format.post }}
<i class="unloaded">{{ lastmod | date_to_xmlschema}}</i>
</span>
</div>
{% endif %}