Skip to content

Commit e5abcef

Browse files
committed
Improve the way to define and use date-format.
1 parent 0a72a86 commit e5abcef

7 files changed

Lines changed: 22 additions & 26 deletions

File tree

_data/date_format.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# The date format
2+
# v2.1
3+
# https://github.com/cotes2020/jekyll-theme-chirpy
4+
# © 2020 Cotes Chung
5+
# MIT Licensed
6+
7+
8+
tooltip: "%a, %b %e, %Y, %l:%M %p %z"
9+
post: "%b %e, %Y"

_includes/date-format.html

Lines changed: 0 additions & 10 deletions
This file was deleted.

_includes/related-posts.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ <h3 class="pt-2 mt-1 mb-4 ml-1" data-toc-skip>{{ site.data.label.post.relate_pos
5353
<a href="{{ post.url | relative_url }}">
5454
<div class="card-body">
5555
<span class="timeago small">
56-
{{ post.date | date: POST_DATE }}
56+
{{ post.date | date: site.data.date_format.post }}
5757
<i class="unloaded">{{ post.date | date_to_xmlschema }}</i>
5858
</span>
5959
<h3 class="pt-0 mt-1 mb-3" data-toc-skip>{{ post.title }}</h3>

_layouts/category.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
# MIT Licensed
77
---
88

9-
{% include date-format.html %}
10-
119
<div id="page-category">
1210
<h1 class="pl-lg-2">
1311
<i class="far fa-folder-open fa-fw text-muted"></i>
@@ -20,7 +18,7 @@ <h1 class="pl-lg-2">
2018
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
2119
<a href="{{ post.url | absolute_url }}">{{ post.title }}</a>
2220
<span class="dash flex-grow-1"></span>
23-
<span class="text-muted small">{{ post.date | date: POST_DATE }}</span>
21+
<span class="text-muted small">{{ post.date | date: site.data.date_format.post }}</span>
2422
</li>
2523
{% endfor %}
2624
</ul>

_layouts/home.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# MIT Licensed
88
---
99

10-
{% include date-format.html %}
11-
1210
<div id="post-list">
1311
{% for post in paginator.posts %}
1412
<div class="post-preview">
@@ -24,8 +22,9 @@ <h1>
2422
<div class="post-meta text-muted pt-1">
2523
<!-- posted date -->
2624
<i class="far fa-clock fa-fw"></i>
27-
<span class="timeago" data-toggle="tooltip" data-placement="bottom" title="{{ post.date | date: TOOLTIP_DATE }}">
28-
{{ post.date | date: POST_DATE }}
25+
<span class="timeago" data-toggle="tooltip" data-placement="bottom"
26+
title="{{ post.date | date: site.data.date_format.tooltip }}">
27+
{{ post.date | date: site.data.date_format.post }}
2928
<i class="unloaded">{{ post.date | date_to_xmlschema }}</i>
3029
</span>
3130
<!-- page views -->

_layouts/post.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@
88
---
99

1010
<div class="row">
11-
{% include date-format.html %}
1211

1312
<div id="post-wrapper" class="col-12 col-lg-11 col-xl-8">
13+
1414
<div class="post pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4">
15+
1516
<h1 data-toc-skip>{{ page.title }}</h1>
17+
1618
<div class="post-meta text-muted d-flex flex-column">
1719
<!-- Published Date and Categoreis -->
1820
<div>
1921
<span class="timeago" data-toggle="tooltip" data-placement="bottom"
20-
title="{{ page.date | date: TOOLTIP_DATE }}">
21-
{{ page.date | date: POST_DATE }}
22+
title="{{ page.date | date: site.data.date_format.tooltip }}">
23+
{{ page.date | date: site.data.date_format.post }}
2224
<i class="unloaded">{{ page.date | date_to_xmlschema }}</i>
2325
</span>
2426
{% if page.categories.size > 0 %}on{% endif %}
@@ -61,8 +63,8 @@ <h1 data-toc-skip>{{ page.title }}</h1>
6163
Updated
6264
<span class="timeago lastmod"
6365
data-toggle="tooltip" data-placement="top"
64-
title="{{ page.seo.date_modified | date: TOOLTIP_DATE }}">
65-
{{ page.seo.date_modified | date: POST_DATE }}
66+
title="{{ page.seo.date_modified | date: site.data.date_format.tooltip }}">
67+
{{ page.seo.date_modified | date: site.data.date_format.post }}
6668
<i class="unloaded">{{ page.seo.date_modified | date_to_xmlschema}}</i>
6769
</span>
6870
</div>

_layouts/tag.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# MIT Licensed
88
---
99

10-
{% include date-format.html %}
11-
1210
<div id="page-tag">
1311
<h1 class="pl-lg-2">
1412
<i class="fa fa-tag fa-fw text-muted"></i>
@@ -20,7 +18,7 @@ <h1 class="pl-lg-2">
2018
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
2119
<a href="{{ post.url | absolute_url }}">{{ post.title }}</a>
2220
<span class="dash flex-grow-1"></span>
23-
<span class="text-muted small">{{ post.date | date: POST_DATE }}</span>
21+
<span class="text-muted small">{{ post.date | date: site.data.date_format.post }}</span>
2422
</li>
2523
{% endfor %}
2624
</ul>

0 commit comments

Comments
 (0)