Howto Build .Rmd with Images in blogdown
CAVEAT: I am very much a newbie to R, rmarkdown, blogdown, bookdown, and Hugo.
I have been racking my brain for a way to do what should be a simple thing using blogdown.
I am experimenting with blogdown, Hugo and a theme for a static website. By the way, I have posted this to Wordpress using R. I have deciphered a way to do that earlier and posted it here. However, I ran into problems attempting to post to a static blog using blogdown and Hugo with a post that contains an image.
First, I have a file that I want in the Rmarkdown syntax with a .rmd extension (I like R). That file contains math formulas, R code blocks that need to execute (this breaks Hugo and the .md formatted file). The .rmd file needs to be several things; a PDF file and a HTML file. I want the file notation to use rmarkdown syntax, including the image reference. Now, this creates a problem for the theme I elect to use (gohugo-theme-ananke).
Hugo does different things with .rmd files and .md files. So I was jumping through hoops trying to figure how to do this, and now find out two things need to be done.
- First, the config.toml file needs to have this added in the top section:
ignoreFiles = ["\\.Rmd$", "\\.rmd$", "\\.Rmarkdown$", "_files$", "_cache$"] - Secondly, to enter images in a Rmd file, just add this line:

Notice there are no quotes around the filename. And that is the gist of it.
Another problem I had was getting the date and title into a post. This is done easiest with the following line from inside R:blogdown:::new_post()
which gives a interactive GUI to enter the info. Then close that html window and you see a file in vim. You can add content there or close and edit it in a GUI text editor. I prefer the standard gnome text editor because of the highlighting functionality.
If the website needs to be built, from within R, type the following: blogdown::build_site(method="html")
Next, starting the website can be done two ways, within R with: blogdown::serve_site()
or from the CLI as such: hugo server