Insert image into Rmd document / Hugo & Bookdown

Dear all,

I'm using bookdown with hugo to create my blog.
I have created a post in RMarkDown .rmd

In this post, I try to insert a image as:

```{r, out.width='50%', fig.align='center'}

with my image saved in:

But instead of having the image display, I can only see a square and my image is not displayed. I tried to change the image with one working as header or change the image to jpg or png but impossible to display it.

Anyone as a solution or an idea ?

Ps: I also try with ![]('content/post/welcome-path.pdf')

Thanks a lot,


One of the easiest things to do is to use the static folder for static files like images. See section 2.7 of the blogdown book.

While I haven't done it, it looks like you can put images other places, as well. I see lots of good info in this GitHub issue thread, which may solve your problem:

1 Like

I think you mean blogdown as opposed to book down? The demo site has some info on this issue (link below): the tl;dr is that I recommend placing the file not in your post folder, but rather in your /static/ directory. I have a subdirectory in there called images, and put jpg/png files in there. So the chunk call looks like:

```{r knitr-logo, out.width='32.8%','hold'}
knitr::include_graphics(rep('/images/knit-logo.png', 3))


Hi !

Thanks to both of you.

Looks like a tried several option but I was just saving, not rendering the site :frowning:
Second problem was my file, it was a .pdf which was not rendering with include_graphics().

All sorted now !

Thanks a lot.

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: FAQ: How do I mark a solution?

Also, in the interest of keeping things tidy :sparkles:, since it seems like this was a blogdown question after all, would you mind editing the typo in the title? (You have the power to edit your own topic title, categories, etc — look for a little pencil icon at the end of the title when you’re scrolled all the way to the top of the page).

1 Like