Are the EJS files for included listing styles available for adaptation? #7089
-
DescriptionI would like to adapt the listings included in Quarto - default, table, grid. Ideally I would take the EJS that produces the equivalent to what Quarto produces out of the box and adapt the EJS template. I wasn't able to find the EJS files in the repo - did I miss something or are the listings produced in some other way? If the latter, would it be possible to include the "equivalent" EJS files in the repo or in the documentation? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
They are generated via EJS and can be found here: https://github.com/quarto-dev/quarto-cli/tree/main/src/resources/projects/website/listing They can be a little hard to adapt as they have a lot support for options and other conditions (which typically custom styles wouldn't need to support). They can provide a started but if they're hard to navigate, feel free to ask and we can try to provide some pointers or simpler examples. Here is a recent example I provided of a very simple version of something closer to our 'default' style listing: <div class="list quarto-listing-default">
<% for (const item of items) { %>
<div class="quarto-post image-<%= imageAlign %>" <%= listing.utilities.metadataAttrs(item) %>>
<div class="thumbnail">
<a href="<%- item.path %>">
<!-- preview image tag here -->
</a>
</a>
</div>
<div class="body">
<a href="<%- item.path %>">
<h3 class="no-anchor listing-title"><%= item.title %></h3>
<div class="listing-subtitle"><%= item.subtitle %></div>
</a>
<div class="listing-categories">
<% for (const category of item.categories) { %>
<div class="listing-category" onclick="window.quartoListingCategory('<%=category%>'); return false;"><%= category %></div>
<% } %>
</div>
<a href="<%- item.path %>">
<div class="delink listing-description">
<%= item.description %>
</div>
</a>
</div>
<div class="metadata">
<a href="<%- item.path %>">
<!-- meta stuff here -->
</a>
</div>
</div>
<% } %>
</div> |
Beta Was this translation helpful? Give feedback.
-
Thanks, that's very helpful! |
Beta Was this translation helpful? Give feedback.
-
@dragonstyle - could you provide any context why the official Quarto versions are saved as Seconding @petrbouchal - thanks for the simplified "default"! I'm trying to make minor tweaks that will look consistent with places where I'm using the default so it's a great lauchpad. |
Beta Was this translation helpful? Give feedback.
-
Also @dragonstyle - could you please give an example of how to call your example from a listing configuation? I tried saving that file as
to
I get the error:
which seems to refer the the |
Beta Was this translation helpful? Give feedback.
They are generated via EJS and can be found here:
https://github.com/quarto-dev/quarto-cli/tree/main/src/resources/projects/website/listing
They can be a little hard to adapt as they have a lot support for options and other conditions (which typically custom styles wouldn't need to support). They can provide a started but if they're hard to navigate, feel free to ask and we can try to provide some pointers or simpler examples.
Here is a recent example I provided of a very simple version of something closer to our 'default' style listing: