I'm using an eco renderer within Docpad (building a site based on https://github.com/zenorocha/browser-diet)
In it, I need to find all the documents in a particular sub-directory.
The directory structure is:
/src/documents/test1/test2
I need to find the documents stored in test2
I can find all the documents in test1 using:
<% for item in @getCollection("documents").findAll({ url: $startsWith: '/test1'}, [order:-1]).toJSON(): %>
No documents are returned when I add an extra sub-directory, using:
<% for item in @getCollection("documents").findAll({ url: $startsWith: '/test1/test2'}, [order:-1]).toJSON(): %>
There are documents at that URL, so what am I doing wrong?
I think you are doing it right. I just tested it in my project with the following code (tools is my generic collection defined in docpad.coffee):
and in the console I get only the list of urls that start with /tools/adminui. Just try to investigate it further with console output or share more details