How to add feature or thumbnail image for post in

2019-05-27 11:01发布

问题:

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:

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?

回答1:

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"
---