hexo-theme-keep/layout/common/home-post.ejs

29 lines
1.0 KiB
Plaintext
Raw Normal View History

<div class="home-container">
<!-- 检查当前页面是否为首页 -->
<% if (is_home()) { %>
<ul class="article-post-list">
<% page.posts.forEach(post => { %>
<li class="article-post-item">
<div class="article-post-title">
<h3>
<a href="<%- url_for(post.path) %>"><%= post.title %></a>
</h3>
</div>
<div class="article-post-content">
<!-- truncate() 移除超过 length 长度的字符串。length 的默认值是 30。 -->
<%- truncate(strip_html(post.content), {length: 80}) %>
</div>
<div class="article-meta-info-container">
<%- partial('article-meta-info', {articleData: post, index: true}) %>
</div>
</li>
<% }) %>
</ul>
<% } %>
<!-- 分页器 -->
<%- partial('paginator') %>
</div>