#Display a dynamically-chosen image on specific pages in Starlight?

3 messages · Page 1 of 1 (latest)

glass fossil
#

Say I want every doc contained within directory /foo to insert an image at the top of the content, matching the title of that doc. So, /foo/abc would insert abc.png, /foo/xyz would insert xyz.png, etc.

What would be the ideal way of approaching this? Overriding MarkdownContent to conditionally include the image before the rest of the content? Or something else? Or should I reconsider this approach entirely?

wide shell
#

The very simplest is to add the image manually each time to the content files, but I guess if that sounded OK, you wouldn’t be asking 😄

So, yes an override could be a good option for your use case I think. It could check the path starts with /foo/ and then work out the image to display.

glass fossil