The goal is to be able to reproduce a website like "adv-r.had.co.nz", writing the content using rmd files, and to be able to embed (and serve) shiny content.
The way suggested by RStudio, in their rmarkdown documentation, is that the author provides an Rmd document to shiny-server, and it renders the entire document (including shiny) whenever the user demands it. In essence, shiny-server takes over the job that jekyll does for "adv-r.had.co.nz".
I have some questions about performance, caching strategies, and the like - but those will wait until I understand better the process.
There are formatting options; the author can create a template and tell shiny-server to use it when compiling. Looking again at the documentation, it seems that the tempate functions are defined in a package, then each Rmd file invokes the package and the template function in the output: bit of yaml. The template functions allow the author to define header and footer files, as well as an in_header argument, which may be useful to generate site-specific naviagation across pages.
It can actually be simpler than this. One simply creates a file _output.yaml in the root directory. This supersedes the output: list in each of the .Rmd files.
html_document:
theme: united
includes:
in_header: include/in_header.html
before_body: [
include/navbar-open.html,
include/nav-temp_rise.html,
include/navbar-close.html
]
after_body: include/footer.html
fig_width: 6
fig_height: 4
A useful function for a package would be to create the skeleton framework for a site (be it a website or a series of slideshows).
One caveat, we would need a seperate directory for the slideshows, and a seperate copy of the data. (can we do symbolic links in git? A: it appears to be fraught with problems)
Let's think about how to deploy a site. You would need a package that would contain the template functions (or files). You could make a repository that would have all the Rmd files (perhaps organized into files). On the deployment server, to update the template, one would simply intstall_github the template package. To update the content, one would simply git pull the content from GitHub (or wherever).
Question: when shiny-server renders the document, what is its working directory?
This could be a clue, there is a dir argument to the rmarkdown::run function. The default is the parent directory of the Rmd file. If the author has a series of Rmd files that share the same data, they could all be put into the same folder, or the data could be put into a package.
The answer here seems to be to provide a data directory as a sub-directory of the root, then to read data from there.