Improve the way to define and use date-format.
This commit is contained in:
parent
4661ec95b9
commit
b3c493a6de
7 changed files with 22 additions and 26 deletions
9
_data/date_format.yml
Normal file
9
_data/date_format.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
# The date format
|
||||
# v2.1
|
||||
# https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
# © 2020 Cotes Chung
|
||||
# MIT Licensed
|
||||
|
||||
|
||||
tooltip: "%a, %b %e, %Y, %l:%M %p %z"
|
||||
post: "%b %e, %Y"
|
|
@ -1,10 +0,0 @@
|
|||
<!--
|
||||
Define the liquid date formats.
|
||||
v2.0
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2019 Cotes Chung
|
||||
Published under the MIT License
|
||||
-->
|
||||
|
||||
{% assign TOOLTIP_DATE = "%a, %b %e, %Y, %l:%M %p %z" %}
|
||||
{% assign POST_DATE = "%b %e, %Y" %}
|
|
@ -53,7 +53,7 @@
|
|||
<a href="{{ post.url | relative_url }}">
|
||||
<div class="card-body">
|
||||
<span class="timeago small">
|
||||
{{ post.date | date: POST_DATE }}
|
||||
{{ post.date | date: site.data.date_format.post }}
|
||||
<i class="unloaded">{{ post.date | date_to_xmlschema }}</i>
|
||||
</span>
|
||||
<h3 class="pt-0 mt-1 mb-3" data-toc-skip>{{ post.title }}</h3>
|
||||
|
|
|
@ -6,8 +6,6 @@ layout: page
|
|||
# MIT Licensed
|
||||
---
|
||||
|
||||
{% include date-format.html %}
|
||||
|
||||
<div id="page-category">
|
||||
<h1 class="pl-lg-2">
|
||||
<i class="far fa-folder-open fa-fw text-muted"></i>
|
||||
|
@ -20,7 +18,7 @@ layout: page
|
|||
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
||||
<a href="{{ post.url | absolute_url }}">{{ post.title }}</a>
|
||||
<span class="dash flex-grow-1"></span>
|
||||
<span class="text-muted small">{{ post.date | date: POST_DATE }}</span>
|
||||
<span class="text-muted small">{{ post.date | date: site.data.date_format.post }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
@ -7,8 +7,6 @@ layout: page
|
|||
# MIT Licensed
|
||||
---
|
||||
|
||||
{% include date-format.html %}
|
||||
|
||||
<div id="post-list">
|
||||
{% for post in paginator.posts %}
|
||||
<div class="post-preview">
|
||||
|
@ -24,8 +22,9 @@ layout: page
|
|||
<div class="post-meta text-muted pt-1">
|
||||
<!-- posted date -->
|
||||
<i class="far fa-clock fa-fw"></i>
|
||||
<span class="timeago" data-toggle="tooltip" data-placement="bottom" title="{{ post.date | date: TOOLTIP_DATE }}">
|
||||
{{ post.date | date: POST_DATE }}
|
||||
<span class="timeago" data-toggle="tooltip" data-placement="bottom"
|
||||
title="{{ post.date | date: site.data.date_format.tooltip }}">
|
||||
{{ post.date | date: site.data.date_format.post }}
|
||||
<i class="unloaded">{{ post.date | date_to_xmlschema }}</i>
|
||||
</span>
|
||||
<!-- page views -->
|
||||
|
|
|
@ -8,17 +8,19 @@ layout: default
|
|||
---
|
||||
|
||||
<div class="row">
|
||||
{% include date-format.html %}
|
||||
|
||||
<div id="post-wrapper" class="col-12 col-lg-11 col-xl-8">
|
||||
|
||||
<div class="post pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4">
|
||||
|
||||
<h1 data-toc-skip>{{ page.title }}</h1>
|
||||
|
||||
<div class="post-meta text-muted d-flex flex-column">
|
||||
<!-- Published Date and Categoreis -->
|
||||
<div>
|
||||
<span class="timeago" data-toggle="tooltip" data-placement="bottom"
|
||||
title="{{ page.date | date: TOOLTIP_DATE }}">
|
||||
{{ page.date | date: POST_DATE }}
|
||||
title="{{ page.date | date: site.data.date_format.tooltip }}">
|
||||
{{ page.date | date: site.data.date_format.post }}
|
||||
<i class="unloaded">{{ page.date | date_to_xmlschema }}</i>
|
||||
</span>
|
||||
{% if page.categories.size > 0 %}on{% endif %}
|
||||
|
@ -61,8 +63,8 @@ layout: default
|
|||
Updated
|
||||
<span class="timeago lastmod"
|
||||
data-toggle="tooltip" data-placement="top"
|
||||
title="{{ page.seo.date_modified | date: TOOLTIP_DATE }}">
|
||||
{{ page.seo.date_modified | date: POST_DATE }}
|
||||
title="{{ page.seo.date_modified | date: site.data.date_format.tooltip }}">
|
||||
{{ page.seo.date_modified | date: site.data.date_format.post }}
|
||||
<i class="unloaded">{{ page.seo.date_modified | date_to_xmlschema}}</i>
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
@ -7,8 +7,6 @@ layout: page
|
|||
# MIT Licensed
|
||||
---
|
||||
|
||||
{% include date-format.html %}
|
||||
|
||||
<div id="page-tag">
|
||||
<h1 class="pl-lg-2">
|
||||
<i class="fa fa-tag fa-fw text-muted"></i>
|
||||
|
@ -20,7 +18,7 @@ layout: page
|
|||
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
||||
<a href="{{ post.url | absolute_url }}">{{ post.title }}</a>
|
||||
<span class="dash flex-grow-1"></span>
|
||||
<span class="text-muted small">{{ post.date | date: POST_DATE }}</span>
|
||||
<span class="text-muted small">{{ post.date | date: site.data.date_format.post }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue