quarto presentation using relative links outside of presentation folder

Problem

I often use the same images/vidoes across lectures. To avoid file duplication, I have a shared_media folder. So my file structure might be something like

markdown_presentations
|__media_shared
    |__images
    |__video
|__lectures
    |__lecture1
        |__lecture1.rmd
       |__media
    |__lecture2
    |__etc.

Using xaringan I can display media stored either the directory containing the presentation, but also use relative links to grab images/videos from a parent folder. Using quarto, images in parent folders referenced with relative links don't display locally when rendering (maybe they would on my server but when writing the presnetation I need to see the images.

Reproducible example

This zip file contains a reprex.

File structure of reprex:

talks
|-- talks.RProj
|-- repo_eg
     |
     |-- image_weirdness.qmd
     |-- media
           |-- ais_02_cover.png
|-- shared_media
     |-- ais_02_cover.png

Images can be stored either in the media directory of the repo_eg direction (in which the presentation is stored), or in the shared_media folder in the parent directory (talks).

When rendering locally I can display an image from within my project folder using

![](media/ais_02_cover.png){.absolute .fragment bottom="50" right="130" width="300"}

but using

![](../shared_media/ais_02_cover.png){.absolute .fragment bottom="50" right="130" width="300"}

fails even though the image is displayed in the quatro visual editor (i.e. the file path is correct).

My need

Can someone explain why images outside of the presentation folder don't render in quarto but will with xarangin? Is this a local rendering issue and all will be fine once pushed to my github.io? If it is a local problem then is there a workaround? There's so much trial and error with scaling/displaying images that you need to be able to render locally (IMO) while creating the presentation.

4 Likes

This topic was automatically closed 21 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.