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

@ -3,7 +3,7 @@
<hr/>
<div class="article-inner">
<%- partial('post/gallery') %>
<% if (post.link || post.title){ %>
<% if (post.link || post.title) { %>
<header class="article-header">
<%- partial('post/title', {class_name: 'article-title'}) %>
</header>
@ -11,7 +11,7 @@
<div class="article-entry typo" itemprop="articleBody">
<% if (post.excerpt && index){ %>
<%- post.excerpt %>
<% if (theme.excerpt_link){ %>
<% if (theme.excerpt_link) { %>
<p class="article-more-link">
<%- link_to(url_for(post.path)+'#more', theme.excerpt_link) %>
</p>
@ -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'}) %>
@ -33,7 +39,7 @@
<%- partial('post/category') %>
</li>
<% } %>
<% if (post.tags && post.tags.length){ %>
<% if (post.tags && post.tags.length) { %>
<li>
<span class="label"><%= __('tag') %>:</span>
<%- partial('post/tag') %>
@ -43,7 +49,7 @@
</ul>
</footer>
</div>
<% if (!index){ %>
<% if (!index) { %>
<%- partial('post/nav') %>
<% } %>
</article>

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>