Skip to content
This repository

Calling partial doesn't render document first #246

Closed
njx opened this Issue · 4 comments

2 participants

Narciso Jaramillo Benjamin Arthur Lupton
Narciso Jaramillo
njx commented

As mentioned in this thread on the Google Group: https://groups.google.com/forum/?fromgroups#!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 https://github.com/njx/njx.github.com-src/blob/master/src/documents/index.html.jade -- 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)

Benjamin Arthur Lupton
Owner

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
Narciso Jaramillo
njx commented

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.

Benjamin Arthur Lupton
Owner

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 :)

Benjamin Arthur Lupton
Owner

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.

Benjamin Arthur Lupton 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.