feat: add updated date

post.updated variable is not used because it's the time 'hexo generate' is executed,
post.updated includes non-content update.
This commit is contained in:
curben 2018-11-01 11:35:02 +10:30
parent 9e1620e7ce
commit 316aa03bd8
4 changed files with 17 additions and 4 deletions

View File

@ -18,3 +18,4 @@ rss_feed: RSS Feed
category: Category
tag: Tag
date_published: Published Date
date_updated: Last Updated

View File

@ -18,3 +18,4 @@ rss_feed: RSS Feed
category: Category
tag: Tag
date_published: Published Date
date_updated: Last Updated

View File

@ -23,6 +23,12 @@
</div>
<footer class="article-footer">
<ul class="article-meta">
<% if (post.lastUpdated) { %>
<li>
<span class="label"><%= __('date_updated') %>:</span>
<%- partial('post/updated-date', {class_name: 'article-date', date_format: 'D MMM YYYY'}) %>
</li>
<% } %>
<li>
<span class="label"><%= __('date_published') %>:</span>
<%- partial('post/date', {class_name: 'article-date', date_format: 'D MMM YYYY'}) %>

View File

@ -0,0 +1,5 @@
<%/* User-specified updated date */%>
<%/* default post.updated is (almost) always is the time 'hexo generate' is executed */%>
<a href="<%- url_for(post.path) %>" class="<%= class_name %>">
<time datetime="<%= date_xml(post.lastUpdated) %>" itemprop="dateUpdated"><%= date(post.lastUpdated, date_format) %></time>
</a>