40 lines
1.5 KiB
Plaintext
40 lines
1.5 KiB
Plaintext
<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 class="article-title-hover-animation" 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('common/article-meta-info', {articleObject: post, index: true}) %>
|
|
</div>
|
|
</li>
|
|
<% }) %>
|
|
</ul>
|
|
|
|
<div class="paginator">
|
|
<% if (page.prev) { %>
|
|
<a class="prev btn"
|
|
href="<%- url_for(page.prev == 1 ? '' : '/page/' + page.prev) %>"
|
|
><%- __('prev') %></a>
|
|
<% } %>
|
|
|
|
<% if (page.next) { %>
|
|
<a class="next btn"
|
|
href="<%- url_for('/page/' + page.next) %>"
|
|
><%- __('next') %></a>
|
|
<% } %>
|
|
</div>
|
|
<% } %>
|
|
|
|
</div> |