Skip to content


Calling partial doesn't render document first #246

njx opened this Issue · 4 comments

2 participants


As mentioned in this thread on the Google Group:!topic/DocPad/Gp6xJ4WpiyQ

When calling a partial to include an existing (renderable) document, the document doesn't seem to be rendered first. I have to manually get the document model and call render() on it in order to access the contentRendered property.

To see how I'm working around it, you can look at -- it seems like I shouldn't have to do this in order to get at the rendered version of the doc.

(EDIT: updated link above since I refactored the docpad src out of my page repo)

DocPad member

Hrmm, we do a double render of everything in order to prevent things like this, however I guess that perhaps this code here could be preventing access to the previous render that you need for your use case.

It is a very weird use case btw, but alas we should still support it. Does removing these lines work?

Steps to test this out:

  1. clone the docpad repo, cd into it
  2. npm install to install docpad's dependencies
  3. make the change
  4. make compile to compile the coffeescript to javascript
  5. npm link to direct docpad to your local copy

I'll give it a shot tomorrow, but since you mentioned this seems like a weird use case--is there a more correct way to get rendered post content included in an index page? That seems pretty standard for blogs.

DocPad member

That is the totally fine bit. The weird bit is using a partial to wrap the current content, never seen that before. But hey, weird definitely does not mean wrong - with docpad, there is no wrong or right way :)

DocPad member

This should now be fixed in DocPad 6.1 as we no longer do that content rendered reset between render passes. Can you give it another go? Closing for now.

@balupton balupton closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.