Note: This tiny intro is an excerpt from the full documentation at http://rmarkdown.rstudio.com/rmarkdown_websites.html. Go read the full documentation there!
You can render collections of R Markdown documents as a website using the rmarkdown::render_site function. These features are available only in the most recent version of the rmarkdown package (v0.9.6).
The RStudio IDE also includes integrated support for developing R Markdown websites. These features are available in the current Preview Release.
Here’s a simple example, a website that includes two pages (Home and About) and a navigation bar to switch between them:
_site.yml
name: "my-website"
navbar:
title: "My Website"
left:
- text: "Home"
href: index.html
- text: "About"
href: about.html
index.Rmd
---
title: "My Website"
---
Hello, Website!
about.Rmd
---
title: "About This Website"
---
More about this website.
All you need for a minimal website is an index.Rmd and a _site.yml file. If you execute rmarkdown::render_site() or hit the “Build website” button in RStudio, the following happen:
The master branch of this repo tracks all source files and rendered output. The rendered _site/ directory is not tracked on master, and is deployed to the gh-pages branch using ghp-import. Commit all changes and push the repo to the master branch then run ghp-import on the _site/ directory (run ghp-import -h to get some help).
ghp-import -p -n -m "$(date)" _site
See the full documentation for authoring RMarkdown Websites at http://rmarkdown.rstudio.com/rmarkdown_websites.html.
The source code for this repo is at https://github.com/UVa-R-Users-Group/rmdwebdemo.
The Bioconnector workshop’s course content is made entirely using this framework. This includes a more complicated and customized nav bar and many more pages.