Converting blogdown site to bookdown/PDF

I've built a couple college courses using blogdown (see, for instance), and it's been delightful building a whole website (with assignments, lectures, etc.) with R.

In academia, though, the world runs on static files, and I've gotten a lot of requests to submit/share the course as a PDF document (for evaluations, tenure packets, and whatnot). That should, in theory, be really easy since the whole course site is just a set of Rmd files. However, files in a blogdown project are not structured in a way that works automatically with bookdownβ€”with blogdown, everything lives in a content directory, with files nested in subdirectories there, like so (see

β”œβ”€β”€ _index.Rmd
β”œβ”€β”€ _output.yaml
β”œβ”€β”€ assignment
β”‚   β”œβ”€β”€ 01-assignment.Rmd
β”‚   └── 02-assignment.Rmd
β”œβ”€β”€ class
β”‚   β”œβ”€β”€ 01-class.Rmd
β”‚   └── 02-class.Rmd
β”œβ”€β”€ reading
β”‚   β”œβ”€β”€ 01-reading.Rmd
β”‚   └── 02-reading.Rmd
β”œβ”€β”€ schedule.Rmd
└── syllabus.Rmd

What would be the best way to convert a blogdown site to a single static PDF? Here's what I've thought about so far:

  • Copy each file from the blogdown site to a new bookdown site, renaming each file so that the order is correct.
    • Pros: Uses bookdown
    • Cons: Lots of manual work; any changes to the blogdown site later won't be picked up by the bookdown version
  • Symlink each file from the blogdown site to a new bookdown site, again renaming each file so that the order is correct
    • Pros: Uses bookdown; symlinks ensure that the most recent version of each Markdown file is used
    • Cons: Still lots of manual upfront work
  • Set keep_md: yes in the YAML heading in blogdown, copy/symlink all the generated Markdown files to a new directory, and use pandoc to build a big PDF, thus bypassing bookdown and knitr and all R-related software
    • Pros: No need to force Rmd files to fit bookdown's paradigm
    • Cons: Lots and lots of manual work

Unless I'm missing some magic create_pdf parameter in blogdown, I'm not seeing an easy way to create a single PDF from this blogdown site. Any ideas?


Currently there isn't an easy way (at least not straightforward), but you seem to be able to read my mind. This is exactly what I plan to implement in the future: turn (a subset of) a blogdown website to a book. I was literally thinking about it early this morning.


Oh cool, that sounds great! In the meantime, I'll just copy/paste/symlink away :slight_smile:

It is good to add this feature in the future version of blogdown.

Hope it will come soon!

1 Like