Closed dragonstyle closed 1 year ago
This is now supported via template-params
, which can be passed to a listing like so:
listing:
contents: posts
template: my-custom-template.ejs
template-params:
author: "NAME"
and referenced like:
<ul class="pub-list list">
<% for (const item of items) { %>
<% if(!templateParams.name || item.author.match(templateParams.name) ){ %>
<li <%= metadataAttrs(item) %>>
<span class="listing-title"><%= item.title %>.</span>
</li>
<% } %>
<% } %>
</ul>
Discussed in https://github.com/quarto-dev/quarto-cli/discussions/2828
<% for (const item of items) { %> <% if(item.author.match("NAME") ){ %>- >
<%= item.title %>.
<% } %>
<% } %>
``` I'm wondering if there is a way to 1. retrieve the `"NAME"` pattern from the meta data of the page which is contains the listing, or 2. a different way to pass down variables to ejs templates?