I've built a couple college courses using blogdown (see https://datavizf17.classes.andrewheiss.com/, 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 https://github.com/andrewheiss/dataviz.andrewheiss.com):
content
├── _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?