Is it possible to add the site navigation to a partial file?
I like to keep things clean in my documents and really prefer seperating out the navigation but I have been having problems in Docpad when I add the navigation to the Partial file.
I am using Jade instead of eco. When I place the navigation in my default.html.md.jade file it works perfectly.
When I put the code in partials/nav.html.jade I get this error: warning: Something went wrong while rendering: html5-boilerplate.docpad/src/partials/nav.html.jade
And this shows up in the compiled HTML:
<header>TypeError: Object #<Object> has no method 'getCollection'</header>
This is my navigation code:
nav
ul
each doc in getCollection('pages').toJSON()
- clazz = (document.url === doc.url) ? 'active' : null
li(class=clazz)
a(href=doc.url, title=doc.title)= doc.title
And this is how I set up my collections inside docpad.coffee
collections:
pages: (database) ->
database.findAllLive({pageOrder: $exists: true}, [pageOrder:1,title:1])
posts: (database) ->
database.findAllLive({relativeOutDirPath:'posts'},[date:-1])