在 Hexo.js 中,当你想输出一些文章时,你使用.sort,.limit和循环.each,例如:
<% site.posts.sort('date', 'desc').limit(8).each(function(post){ %>
<div id="post-1" class="post">
<%= post.title %>
all the other post tags and content
</div>
<% }) %>
您如何将 id 号设置post-X为动态递增,例如第一篇文章会得到id="post-1",第二篇id="post-2"等等?