I am trying to make a blog using the trio of jekyll, rmarkdown and github (like here: http://yihui.name/knitr-jekyll/ )
I have all my .Rmd in _source, and I have this problem that sometimes the graphics are knitted in the base 64 images and sometimes saved in the pictures folder.
The first question is why?
Second question: when my plot is saved as images, the html path looks like figure / source /. Knowing that the destination folder is / blog / (my baseurl in _config.yml), to make it work, it must be a blog / figure / source.
Strange, they are displayed locally and when I open html with my browser. But when I deploy my site on github, the images do not appear, since the path is wrong.
How to define the path to / blog / figure instead of / figure /?
Edit: A link to my blog is still under construction: http://yvescr.imtqy.com/
But Rmd does not appear on the github account, since the folder synchronized with github is the jekyll generation target file.
_config.yml:
# Build settings markdown: kramdown baseurl: "/blog"
In R:
jekyll(dir = ".", input = "_source", output = "_posts", script = c("Makefile", "build.R") , command = "jekyll build --destination ../blog")
build.r:
local({ # fall back on '/' if baseurl is not specified baseurl = servr:::jekyll_config('.', 'baseurl', '/') knitr::opts_knit$set(base.url = baseurl) # fall back on 'kramdown' if markdown engine is not specified markdown = servr:::jekyll_config('.', 'markdown', 'kramdown') # see if we need to use the Jekyll render in knitr if (markdown == 'kramdown') { knitr::render_jekyll() } else knitr::render_markdown() # input/output filenames are passed as two additional arguments to Rscript a = commandArgs(TRUE) d = gsub('^_|[.][a-zA-Z]+$', '', a[1]) knitr::opts_chunk$set( fig.path = sprintf('blog/figure/%s/', d), cache.path = sprintf('cache/%s/', d) ) knitr::opts_knit$set(width = 70) knitr::knit(a[1], a[2], quiet = TRUE, encoding = 'UTF-8', envir = .GlobalEnv) })
Makefile:
all: Rscript -e "servr::jekyll('..')" clean: rm -r ../blog/