mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-18 05:41:31 +00:00
perf: avoid the layout shift for post datetime
This commit is contained in:
21
_includes/datetime.html
Normal file
21
_includes/datetime.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!--
|
||||
Date format snippet
|
||||
See: ${JS_ROOT}/utils/locale-dateime.js
|
||||
-->
|
||||
|
||||
{% assign wrap_elem = include.wrap | default: 'em' %}
|
||||
|
||||
{% if site.prefer_datetime_locale == 'en' or lang == 'en' %}
|
||||
{% assign df_strftime = '%b %e, %Y' %}
|
||||
{% assign df_dayjs = 'll' %}
|
||||
{% else %}
|
||||
{% assign df_strftime = '%F' %}
|
||||
{% assign df_dayjs = 'YYYY-MM-DD' %}
|
||||
{% endif %}
|
||||
|
||||
<{{ wrap_elem }} class="{% if include.class %}{{ include.class }}{% endif %}"
|
||||
data-ts="{{ include.date | date: '%s' }}"
|
||||
data-df="{{ df_dayjs }}"
|
||||
{% if include.tooltip %}data-toggle="tooltip" data-placement="bottom"{% endif %}>
|
||||
{{ include.date | date: df_strftime }}
|
||||
</{{ wrap_elem }}>
|
||||
Reference in New Issue
Block a user