4
我正在做一个投资组合,并希望简单地打印使用DocPad(使用骨干集合)每个项目详细信息页面上的次&以前的项目链接。这里的代码是从我的模板projects.html.eco。所述@document对象是当前正在观看的文档。获取收集下一个和以前的文件与docpad
<% for document in @getCollection('projects').toJSON() : %>
<% if document.url.indexOf('/posts') is @document.url.indexOf('/projects') + 1: %>
<a href="<%= document.url %>" class="next"><img src="/images/rt_arrow.png" alt="" /></a>
<% end %>
<% if document.url.indexOf('/posts') is @document.url.indexOf('/projects') - 1: %>
<a href="<%= document.url %>" class="previous"><img src="/images/lft_arrow.png" alt="" /></a>
<% end %>
<% end %>
让我知道如果我可以提供任何更多的信息!
谢谢!
谢谢你,这个完美! –