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 %>
讓我知道如果我可以提供任何更多的信息!
謝謝!
謝謝你,這個完美! –