feat(post): displays the post update time (#145)

This commit is contained in:
XPoet 2022-10-08 23:43:52 +08:00
parent e931ea8f4f
commit 4d89ea984f
3 changed files with 34 additions and 7 deletions

View File

@ -1,9 +1,22 @@
<%
const ami_is_updated = articleObject.date !== articleObject.updated
%>
<div class="article-meta-info">
<span class="article-date article-meta-item">
<i class="fas fa-edit"></i>&nbsp;
<% if(ami_is_updated) { %>
<i class="fa-regular fa-calendar-plus"></i>&nbsp;
<% } else { %>
<i class="fas fa-edit"></i>&nbsp;
<% } %>
<span class="pc"><%= date(articleObject.date, is_post() ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD') %></span>
<span class="mobile"><%= date(articleObject.date, is_post() ? 'YYYY-MM-DD HH:mm' : 'YYYY-MM-DD') %></span>
</span>
<% if (ami_is_updated) { %>
<span class="article-update-date article-meta-item">
<i class="fas fa-file-pen"></i>&nbsp;
<span class="pc"><%= date(articleObject.updated, 'YYYY-MM-DD HH:mm:ss') %></span>
</span>
<% } %>
<% if (articleObject.categories.length) { %>
<span class="article-categories article-meta-item">
<i class="fas fa-folder"></i>&nbsp;
@ -30,13 +43,13 @@
<% } %>
<%
let temp_wordcount_count, temp_min2read_count = null;
let temp_wordcount_count, temp_min2read_count = null
try {
temp_wordcount_count = wordcount(page.content);
temp_min2read_count = min2read(page.content);
temp_wordcount_count = wordcount(page.content)
temp_min2read_count = min2read(page.content)
} catch (e) {
temp_wordcount_count = 0;
temp_min2read_count = 0;
temp_wordcount_count = 0
temp_min2read_count = 0
}
%>
<% if(is_post() && theme.hasOwnProperty('post') && theme.post.word_count.enable && theme.post.word_count.wordcount && temp_wordcount_count){ %>

View File

@ -1,6 +1,14 @@
<%
const target_date = post.date !== post.updated ? post.updated : post.date
%>
<div class="home-article-meta-info-container">
<div class="home-article-meta-info">
<span><i class="fas fa-history"></i>&nbsp;<span class="home-article-date" data-date="<%= post.date %>"><%= date(post.date, 'YYYY-MM-DD') %></span></span>
<span>
<i class="fas fa-history"></i>&nbsp;
<span class="home-article-date" data-date="<%= target_date %>">
<%= date(target_date, 'YYYY-MM-DD') %>
</span>
</span>
<% if (post.categories.length && theme.home_article.category.enable === true) { %>
<span class="home-article-category"><i class="fas fa-folder"></i>&nbsp;
<ul>

View File

@ -28,6 +28,12 @@
}
.article-update-date {
+keep-tablet() {
display none
}
}
.article-tags
.article-categories {
display inline