How to add feature or thumbnail image for post in .Rmd file

1.4k Views Asked by At

I'm currently trying to setup a hugo blog with blogdown and can't find a way to add feature or thumbnail images to posts from within .Rmd files, which would like this with the tranquilpeak theme:

feature_image

As far as I understand, it is easy to do in .md files by just adding some syntax like this:

+++
featuredImage = "img/foobar.jpg"
+++

I found this in the minos theme and in a discourse post. But how can I do this inside a .Rmd file?

2

There are 2 best solutions below

0
On BEST ANSWER

It does not matter whether you use .md or .Rmd: if the theme supports the featuredImage option, you can also use it in .Rmd. The only thing you need to make sure is to write metadata in YAML instead of TOML if the post format is .Rmd (see documentation), i.e.,

---
featuredImage: "img/foobar.jpg"
---
0
On

One option is to change the .Rmd filename to index.Rmd and use the featured.png/jpg image in the page's folder.

Works fine for me.