From b3c493a6de4c0394428de484e9d8560ef581c1e3 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 22 Feb 2020 07:16:58 +0800 Subject: [PATCH] Improve the way to define and use date-format. --- _data/date_format.yml | 9 +++++++++ _includes/date-format.html | 10 ---------- _includes/related-posts.html | 2 +- _layouts/category.html | 4 +--- _layouts/home.html | 7 +++---- _layouts/post.html | 12 +++++++----- _layouts/tag.html | 4 +--- 7 files changed, 22 insertions(+), 26 deletions(-) create mode 100644 _data/date_format.yml delete mode 100644 _includes/date-format.html diff --git a/_data/date_format.yml b/_data/date_format.yml new file mode 100644 index 0000000..3040be7 --- /dev/null +++ b/_data/date_format.yml @@ -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" \ No newline at end of file diff --git a/_includes/date-format.html b/_includes/date-format.html deleted file mode 100644 index 2929063..0000000 --- a/_includes/date-format.html +++ /dev/null @@ -1,10 +0,0 @@ - - -{% assign TOOLTIP_DATE = "%a, %b %e, %Y, %l:%M %p %z" %} -{% assign POST_DATE = "%b %e, %Y" %} \ No newline at end of file diff --git a/_includes/related-posts.html b/_includes/related-posts.html index bb67ded..ae34eb9 100644 --- a/_includes/related-posts.html +++ b/_includes/related-posts.html @@ -53,7 +53,7 @@
- {{ post.date | date: POST_DATE }} + {{ post.date | date: site.data.date_format.post }} {{ post.date | date_to_xmlschema }}

{{ post.title }}

diff --git a/_layouts/category.html b/_layouts/category.html index 5e9dd1f..1259311 100644 --- a/_layouts/category.html +++ b/_layouts/category.html @@ -6,8 +6,6 @@ layout: page # MIT Licensed --- -{% include date-format.html %} -

@@ -20,7 +18,7 @@ layout: page
  • {{ post.title }} - {{ post.date | date: POST_DATE }} + {{ post.date | date: site.data.date_format.post }}
  • {% endfor %} diff --git a/_layouts/home.html b/_layouts/home.html index 6ebfe51..38d76e3 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -7,8 +7,6 @@ layout: page # MIT Licensed --- -{% include date-format.html %} -
    {% for post in paginator.posts %}
    @@ -24,8 +22,9 @@ layout: page