I have a problem with images not embedding in individual blog posts on my website (built with the distill package).
I've kept an ./images folder in my root directory where I store all images.
In my Rmd blog post, I then reference this file path using knitr::include_graphics("../../images/2020-12-31_look-arounds.jpg"). The image is displayed if I execute the code within my RStudio environment, but it disappears if I knit the Rmd file and rebuild my website.
I'm wondering if there is an alternate file path that is being called when I knit my Rmd file, that I should be specifying and storing individual blog post images in instead?
Have you heard of the here package? I highly encourage you to use it in all your project as it standardizes the way your write your paths in your code.
I've just switched the code chunk to knitr::include_graphics(here("images/2020-12-31_look-arounds.jpg")) but the same bug persists. I do use here() in my workflow ordinarily, but I was under an assumption that it's not so great for website rendering? Thanks for the link though!
I have a feeling that it's a distill problem and my file structure is a bit messy, and maybe the Rmd that gets rendered from the _post folder into post isn't transferring my file path reference?
When an image can't load, you should have a broken image link like this usually
If I look at the HTML code with a browser inspector, I don't find any <img> tag here. So it seems that there is nothing written to the HTML as if the results of the chunk were not included.
So I think the culprit in your case is that you used this as global chunk option
This means, every chunk result will be hidden !! Included the result of
I think that is why you don't see any image embedded. Try changing this option globally (to avoid further error) or set the default back for this chunk.