Skip to content

Instantly share code, notes, and snippets.

@mikeumus
Created March 15, 2013 02:09
Show Gist options
  • Save mikeumus/5166984 to your computer and use it in GitHub Desktop.
Save mikeumus/5166984 to your computer and use it in GitHub Desktop.
How to call getCollection() from a doc inside the collection?
<% for document in @getCollection('./blogs').toJSON(): %>
<li typeof="sioc:Page" about="<%= document.url %>" class="<%= 'active' if @document.url is document.url %>">
<a href="<%= document.url %>" property="dc:title"><%= document.title %></a>
</li>
<% end %>
@mikeumus
Copy link
Author

The above causes the following error:

error: An error occured:
TypeError: Cannot call method 'toJSON' of undefined

One workaround is to have the posts folder lower than the getCollection('posts') or in another documents/posts folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment