Quarto blog posts listing not using first content image

If an image is not provided in the YAML, then the listing of a blog post is supposed to use:

The image for this item, read from the image field of the front matter, or automatically discovered by taking the first of an image of class preview-image , an image with a file name starting with feature , cover , or thumbnail , or the first image to appear in the document.

I'm trying to go for the last option - first image to appear in the document, but it's not working. Reproducible example:

Repository: GitHub - riinuots/quarto_blog
or
RStudio Cloud project: Posit Cloud

The only thing I've changed from the Create new Project - Quarto Blog - are these lines:

What the website looks like:

Whereas I'm expecting the thumbnail for "Post With Code" to be this plot:

Any ideas? Thanks very much in advance. I'm thoroughly enjoying getting to know Quarto. So sleek!

1 Like

I'm having this same issue. Not really sure what the problem is.

1 Like

@riinu thanks for the repository as a reprex. That really helps!

I believe

first image to appear in the document .

does not apply to plots computed from code chunks.

If you try adding


See 

![](image.jpg)

in the .qmd file and rerender the blog, you'll have the image taken in the listing.

I don't know if this is expected or just an oversight, but I believe you could report it in Quarto.
Do you want to open an issue there or should I do it ?

Thanks !

@ethan_tenison Are you also trying to use an image generated in a code chunk ?

In your case it seems the image path is not correctly found as we could see from the broken image link. Would you be able to share a reproducible example ?

I think this could be a different problem.

Yes. I'm also having an issue with the image generated from the code chunk.

This is basically the same as in the python example for quarto

---
title: "Example"
author: "Ethan Tenison"
editor: visual
format:
  html:
    code-fold: true
jupyter: python3
---

Example


#| label: fig-polar
#| fig-cap: "A line plot on a polar axis"

import numpy as np
import matplotlib.pyplot as plt

r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(
  subplot_kw = {'projection': 'polar'} 
)
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()

Thanks so much for having a look!
Does sound like a missing feature rather than a bug then. Would be great if you could open an issue about this! Thanks so much again.

Best wishes,
Riinu

@riinu I believe this has been taken into consideration as part of For website project, images generated by R code does not display normally in listing page · Issue #2042 · quarto-dev/quarto-cli · GitHub

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.