docpad-plugin-partials
docpad-plugin-partials copied to clipboard
Inject meta-data from the partial
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.
Interesting... Is there a real-world use case / demand for this?
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.