-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to call @getCollection("partials") from docpad.coffee #8
Comments
Could be that the partials plugin hasn't been able to create the partials plugin yet. However, you can change your query to |
Are you saying to add that into the docpad.coffee or the .eco file? Adding the suggested statement runs without any errors in docpad.coffee unlike the original query, but when I run Actually, I've just tried it and running that query in my .eco comes back empty anyway. |
Sorry I mustn't have been clear enough. docpad.coffee collections:
objects: (database) ->
database.findAllLive({partial:true, isObject:true}) index.html.eco <% for object in @getCollection("objects").toJSON(): %> |
That didn't seem to make a difference either..See the branch I have here with those changes. index.html.eco is in src/documents. |
I am having the exact same Problem here. I tried to get a collection of all partials with the metatag "isObject"
and call it within a template that uses the paged plugin. This Plugin expects a collection name
Console returns undefined for me |
Not exactly the same use case, but seems a related issue with the partials plugin. From within a <ul>
<% for page in @getCollection("menu").toJSON(): %>
<li class="<%= if page.id is @document.id then 'active' else 'inactive' %>">
<a href="<%= page.url %>">
<%= page.title %>
</a>
</li>
<% end %>
</ul> Then we use this partial in a <%- @partial('header.html.md.eco')%> Unfortunately it outputs: When we do the same not from within a partial, but right away in the Update: Adding @ (~ |
Hey,
I've come across an issue where it seems that I can't define a collection in my
docpad.coffee
that tries to accesspartials
e.g.@getCollection('partials')
.By chucking in some debug statements it seems that the functions for the collections in docpad.coffee are running before
PartialsPlugin.populateCollections
is called so it's alwaysundefined
. But instead if I call@getCollection
from within one of my documents it works fine.I've attached a debug log here.
If you want to replicate the issue it's occurring on my repo here. You'll just have to uncomment the collections in docpad.coffee.
Thanks,
Pat
The text was updated successfully, but these errors were encountered: