ポートフォリオを作成していて、DocPad(Backboneコレクションを使用)を使用して、各プロジェクトの詳細ページに次のプロジェクトと前のプロジェクトのリンクを印刷したいと考えています。ここのコードは私のテンプレートprojects.html.ecoからのものです。@documentオブジェクトは、現在表示されているドキュメントです。
<% 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 %>
さらに情報を提供できるかどうか教えてください!
ありがとうございました!