hexo/themes/blank/layout/partial/recent-posts.ejs

62 lines
2.9 KiB
Plaintext
Raw Normal View History

2024-05-09 10:56:56 +08:00
<% if (page.posts.length > 0) { %>
<div id="recent-posts">
<% page.posts.each(function (post) { %>
<div class="recent-post-item">
<div class="post-title ">
<a href="<%=url_for(post.path)%>"><%=post.title%></a>
</div>
<div class="post-meta">
<% if (post.top || post.sticky > 0) { %>
<div class="post-meta-item top">
<i class="far fa-bookmark"></i>
<span class="sticky"><%= __('Sticky') %></span>
</div>
<% } %>
<% if(theme.post_meta.page.date){ %>
<div class="post-meta-item date">
<span title="<%= __('created') %> <%- date(post.date, 'YYYY.MM.DD') %>"><i class="far fa-calendar-alt"></i> <%- date(post.date, 'YYYY.MM.DD') %></span>
</div>
<div class="post-meta-item updated">
<span title="<%= __('updated') %> <%- date(post.updated, 'YYYY.MM.DD') %>"><i class="far fa-calendar-check"></i> <%- date(post.updated, 'YYYY.MM.DD') %></span>
</div>
<% } %>
<% if(theme.post_meta.page.categories && post.categories.length > 0){ %>
<div class="post-meta-item categories">
<% post.categories.each(function(cate){ %>
<i class="fas fa-inbox article-meta__icon"></i> <a href="<%= url_for(cate.path) %>"><%- cate.name %></a>
<% }) %>
</div>
<% } %>
<% if(theme.post_meta.page.wordcount || theme.post_meta.page.min2read){ %>
<div class="post-meta-item wordcount">
<% if(theme.post_meta.page.wordcount){ %>
<i class="fas fa-pencil-alt"></i> <span class="post-count"><%= wordcount(post.content) %> <%= __('words') %></span>
<% } %>
<% if(theme.post_meta.page.min2read){ %>
<i class="far fa-clock"></i> <span class="post-count"><%= min2read(post.content) %> <%= __('min') %></span>
<% } %>
</div>
<% } %>
</div>
<div class="content">
<% if (post.excerpt) { %>
<%- post.excerpt %>
<% } else if (post.description) { %>
<%- strip_html(post.description) %>
<% } else if (theme.auto_excerpt.enable && post.auto_excerpt) { %>
<%- strip_html(truncate(post.content, {length: theme.auto_excerpt.length})) %>
<% } else { %>
<%- post.content %>
<% } %>
</div>
</div>
<div class="post-footer">
<% if(post.excerpt || post.descripttion || (theme.auto_excerpt.enable && post.auto_excerpt)) { %>
<div class="readmore"><a href="<%=url_for(post.path)%>"><%= __('Read More') %> »</a></div>
<% } %>
</div>
<% }) %>
</div>
<% } %>