docpad-plugin-partials icon indicating copy to clipboard operation
docpad-plugin-partials copied to clipboard

Inject meta-data from the partial

Open RobLoach opened this issue 11 years ago • 2 comments

Usually when building a Partial, you have something like:

Hello <%=@name or 'World'%>
Welcome to <%= @site?.name or 'My Site' %>

Now, what if you could inject meta-data to the document from the Partial itself?


---
someData: "Oh, yes please."

---
Hello <%=@name or 'World'%>
Welcome to <%= @site?.name or 'My Site' %>

Then calling @partial('mypartial') would manipulate the source document's meta-data.

RobLoach avatar Feb 12 '14 22:02 RobLoach

Interesting... Is there a real-world use case / demand for this?

balupton avatar Feb 13 '14 03:02 balupton

Would've solved a problem I was running into, but then I switched to using a layout for it instead. It's still an idea, not entirely sure how feasible it is, but an idea, no less.

RobLoach avatar Feb 13 '14 04:02 RobLoach