diff --git a/_data/date_format.yml b/_data/date_format.yml index 3040be7..0a984ff 100644 --- a/_data/date_format.yml +++ b/_data/date_format.yml @@ -6,4 +6,6 @@ tooltip: "%a, %b %e, %Y, %l:%M %p %z" -post: "%b %e, %Y" \ No newline at end of file +post: + long: "%b %e, %Y" + short: "%b %e" diff --git a/_includes/related-posts.html b/_includes/related-posts.html index bfe4e49..fa256f3 100644 --- a/_includes/related-posts.html +++ b/_includes/related-posts.html @@ -93,10 +93,7 @@
- - {{ post.date | date: site.data.date_format.post }} - {{ post.date | date_to_xmlschema }} - + {% include timeago.html date=post.date class="small" %}

{{ post.title }}

diff --git a/_includes/timeago.html b/_includes/timeago.html new file mode 100644 index 0000000..b6b7bcd --- /dev/null +++ b/_includes/timeago.html @@ -0,0 +1,27 @@ + + + + {% assign this_year = site.time | date: "%Y" %} + {% assign post_year = include.date | date: "%Y" %} + + {% if post_year == this_year %} + {{ include.date | date: site.data.date_format.post.short }} + {% else %} + {{ include.date | date: site.data.date_format.post.long }} + {% endif %} + + {{ include.date | date_to_xmlschema }} + + \ No newline at end of file diff --git a/_layouts/category.html b/_layouts/category.html index a53aff5..70fec40 100644 --- a/_layouts/category.html +++ b/_layouts/category.html @@ -18,7 +18,7 @@ layout: page

  • {{ post.title }} - {{ post.date | date: site.data.date_format.post }} + {{ post.date | date: site.data.date_format.post.long }}
  • {% endfor %} diff --git a/_layouts/home.html b/_layouts/home.html index c6ce1ce..c4ae342 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -66,11 +66,8 @@ layout: page