1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

Redesign the post meta layout

- posted date
- updated date
- read time
- license statement of post bottom
- also refactor the `timeago.js`
This commit is contained in:
Cotes Chung
2021-12-04 06:56:33 +08:00
parent 6220d09ffb
commit 563e8085e8
14 changed files with 113 additions and 112 deletions

View File

@@ -1,27 +1,26 @@
<!--
Date format snippet
See: /assets/js/_utils/timeage.js
See: ${JS_ROOT}/utils/timeago.js
-->
{% assign tooltip_df = site.data.locales[lang].date_format.tooltip %}
{% assign post_long_df = site.data.locales[lang].date_format.post.long %}
{% assign post_short_df = site.data.locales[lang].date_format.post.short %}
{% if include.preposition %}
{{ include.preposition }}
{% endif %}
<span class="timeago {% if include.class %}{{ include.class }}{% endif %}"
{% if include.tooltip %}
data-toggle="tooltip"
data-placement="bottom"
title="{{ include.date | date: tooltip_df }}"
{% endif %}>
<em class="timeago{% if include.class %} {{ include.class }}{% endif %}"
date="{{ include.date }}"
{% if include.tooltip %}
data-toggle="tooltip"
data-placement="bottom"
title="{{ include.date | date: tooltip_df }}"
{% endif %}>
{%- assign this_year = site.time | date: "%Y" -%}
{%- assign post_year = include.date | date: "%Y" -%}
{%- if post_year == this_year -%}
{{ include.date | date: post_short_df }}
{%- else -%}
{{ include.date | date: post_long_df }}
{%- endif -%}
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i>
</span>
</em>