From 7933eccd3e715b631912fec9a81f13c0bb9456ef Mon Sep 17 00:00:00 2001 From: Tao Deng <3070053397@qq.com> Date: Wed, 24 Apr 2024 23:19:36 +0800 Subject: [PATCH] add last updated date to posts (#2341) This PR is related to #2309. I added an optional `last_updated` field. This new field represents the timestamp for when the post was last updated. Consequently, the existing `date` metadata should now be interpreted as the creation date of the post. The formatting for displaying these dates has been standardized as follows: ```text Created: July 11, 2023 | Last Updated: April 14, 2024 ``` For a practical implementation example, please refer to [this post](https://torydeng.github.io/blog/2023/deploying-server/) on my website, where I have applied these changes. --- Any feedback is wellcome. --- _layouts/post.liquid | 5 +++-- _posts/2024-01-27-vega-lite.md | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/_layouts/post.liquid b/_layouts/post.liquid index 1c5c52fc44e6..869d94c6c22b 100644 --- a/_layouts/post.liquid +++ b/_layouts/post.liquid @@ -18,8 +18,9 @@ layout: default

{{ page.title }}

- {{ page.date | date: '%B %d, %Y' }} - {% if page.author %}• {{ page.author }}{% endif %} + Created in {{ page.date | date: '%B %d, %Y' }} + {% if page.author %}by {{ page.author }}{% endif %} + {% if page.last_updated %}, last updated in {{ page.last_updated | date: '%B %d, %Y' }}{% endif %} {% if page.meta %}• {{ page.meta }}{% endif %}

diff --git a/_posts/2024-01-27-vega-lite.md b/_posts/2024-01-27-vega-lite.md index b3569deb50dd..ef4fc4b43955 100644 --- a/_posts/2024-01-27-vega-lite.md +++ b/_posts/2024-01-27-vega-lite.md @@ -2,6 +2,7 @@ layout: post title: a post with vega lite date: 2024-01-27 00:20:00 +last_updated: 2024-04-14 04:30:00 description: this is what included vega lite code could look like tags: formatting charts categories: sample-posts