Posting xaringan presentation on blogdown

blogdown
xaringan

#1

Hello there!
Fearing asking this on SO, I wanted to try the community first.

What's your workflow of publishing your xaringan slides on blogdown? I'm not the sharpest pencil in the box, and I'm not sure how to do it best within the blogdown environment.

I understand blogdown can't render the .Rmd file that is the xaringan presentation, so that leaves me with an .html file and a libs folder. Where do I, ahem, stick it?

Help?


#2

Great little blog post by Tim Mastny on how to do just that: Embed Slides in Your Blog(down).

The gist (though it's short, so I recommend just reading the post):

knitr::include_url('https://timmastny.rbind.io/slides/first_presentation#1')

#3

On the blogdown demo site we link to how to render xaringan type Rmd files:
https://blogdown-demo.rbind.io/2017/09/06/adding-r-markdown-documents-of-other-output-formats/

I will say I have found it easier to store my presentations in a separate repo then link to them from my site though. But, you can actually knit to moon reader from within your blogdown file structure, working in a directory other than contents/post.


#4

Do you have a live example of this setup, please?


#5

Sure I did it here:
Take a Sad Plot & Make it Better


#6

OK I see what you did there. I did it the same way as I needed to publish the slides fast, so I just did the github pages thing: https://taraskaduk.com/talk/sql-sat-759-career/

But I thought there must be a better way, where I don't have to use 2 different domains.

I noticed the way @yihui has his slides published here: https://yihui.name/en/vitae/
His main website is https://yihui.name/, and the slides are at subdomain https://slides.yihui.name/
I find this setup very cool, but I'm not sure how exactly to accomplish that in blogdown. I haven't found a tutorial on this.


#7

My slides are hosted in a Dropbox folder via Updog: https://yihui.name/en/2018/03/pres-rmd-source/. There is only one benefit of it: I don't need to explicitly upload slides.


#8

Do you specify the argument height? When I use the default one 400px, the frame is too small to display the slides.


#9

I've actually never done it myself (that's not my blog post), but, from the look of it, it seems like if you don't specify a height, it'll fit to the maximum width of the theme, and adjust the aspect ratio appropriately (adding margins if necessary). I'm guessing here, though, as (like I said) I haven't actually done it myself.


#10

I use this all the time and have never had the problem are seeing, and never use the height argument. Examples here:

https://apreshill.github.io/data-vis-labs-2018/slides.html

Rmd here: https://raw.githubusercontent.com/apreshill/data-vis-labs-2018/master/slides.Rmd