Open axtimwalde opened 2 months ago
I believe it's because the "PreviewImage" is filled in TypeScript which is bypassed when using a custom listing.
Note that the following custom listing is enough to reproduce:
quarto create project blog demo
template: listing.ejs
in index.qmd
.<ul>
<% for (const item of items) { %>
<li><a href="<%- item.path %>"><%= item.title %></a></li>
<p><img src="<%- item.image%>" width="100px"></p>
<% } %>
</ul>
Bug description
The
item.image
field is not auto-populated for custom listing templates as documented. Only if theimage
property in the YAML block/ file/ whatever is explicitly set, a thumbnail image is successfully created when using a custom template.Why is this important? I find that auto-populating thumbnail images is a super helpful and distinguishing feature of the Quarto publishing system to support code (notebook) driven documentation. Custom templates are often the only way to achieve minor customization but they seem to not have access to preprocessing functions provided by Quarto, i.e. they rightly seem to be pretty far downstream in the food chain. Therefore, cool features like auto-populating thumbnail images for listing items should just work.
The documentation for custom listing templates forwards to the documentation for listing fields which misleads users into believing that
item.image
is auto-populated with alternative thumbnail sources if no explicitimage
property is provided. It feels like custom template developers would be the primary audience of this documentation page, so it should be correct.Steps to reproduce
Alternatively, check out this repository which contains the same.
With this line
https://github.com/axtimwalde/quarto-test/blob/main/index.qmd#L7
only one thumbnail image is shown, without it, two thumbnail images are shown.
Expected behavior
Two thumbnail images sholud be shown with both the default and the custom template.
Actual behavior
Only the default Quarto provided template shows two thumbnail images. the custom template shows only one, for the listing item that explicitly provides an
image
property.Your environment
Plain Ubuntu 23.10 with Firefox as a default browser.
Quarto check output