4

I'm trying to embbed an ioslides rmarkdown presentation in a jekyll website, so I need to render the .Rmd file to a _posts folder in the main directory of my website.

But, images can't be placed in this folder, so I'm placing then in a images folder.

My problem is that when I render my .Rmd all dependencies are placed in the same folder as the output file.

I tried to use the self_contained: false and then pass the following arguments to knitr, but this didn't work.

knitr::opts_chunk$set(fig.path = "/images/")
Daniel Falbel
  • 1,721
  • 1
  • 21
  • 41
  • do you have permission to create and write in the `/images/` folder from where the `render` is run? – NicE Jan 29 '16 at 19:47
  • @Daniel, have a look at this post that I have answered. I think this will help you in what you need as it is in a similar train of thought as your question:[Output dependencies through a script to a specific folder](http://stackoverflow.com/questions/35047164/when-using-servrjekyll-on-r-where-should-i-save-my-rmd-files/35048414#35048414) – Hanjo Odendaal Feb 01 '16 at 14:00
  • i'm using something like this in my site, but it doesn't work for ioslides presentations :( – Daniel Falbel Feb 05 '16 at 18:03
  • I do not know why it does not work for you, but see how I apply this: [code](https://github.com/setempler/setempler.github.io/blob/master/Makefile) and [details](http://setempler.github.io/blog/2016-03-24/using-rmd-with-jekyll) – setempler Mar 25 '16 at 00:18
  • I think the problem is something in ioslides. When using in raw Rmd this works ok – Daniel Falbel Apr 07 '16 at 16:36

1 Answers1

0

fig.path indicates a folder relative to the project folder. In your case you have to use base.dir to set an absolute folder:

knitr::opts_chunk$set(base.dir = "/images/")
HubertL
  • 19,246
  • 3
  • 32
  • 51
  • this doesn't work :( rmarkdown keeps creating a folder called `filename_files` to store the created images. – Daniel Falbel Feb 05 '16 at 18:01
  • For me it works, but I use `fig.path` with `"images/"` instead `"/images/"`. See also the [code](https://github.com/setempler/setempler.github.io/blob/master/Makefile) and [details](http://setempler.github.io/blog/2016-03-24/using-rmd-with-jekyll). – setempler Mar 25 '16 at 00:15