Instructions

Here are some recaps of the workshop on how to set up your website in R Markdown and GitHub.

Setting Up

Version 1

Creating the website template on your computer

  1. In RStudio, make sure the following packages are loaded by running the following codes:
  1. Make a new R Project by clicking on the New Project button. New Directory

  2. Click on New Directory, than select Distill Website from the list.

  3. Give your Website a directory name (a.k.a. name the folder), the title of your website (can be changed later) and check the box to configure for Github Pages! Now you have created a basic template. Make sure to save your .Rmd (R Markdown) files and render_site(), so that your .Rmd will be made into .html.

Uploading your website on GitHub

Your website template is there, but no one see it yet, because it is not “in the cloud”. For this, we will use GitHub Pages.

  1. Go to GitHub and create a new repository. You can click on the plus button on the top right corner.

  2. Give your new repository a name, add a README file and .gitignore like shown in the screenshot below. Then create! New Repository

  3. Go to the Settings of your repository, click on Pages and change the Branch to the docs folder and save.This tells GitHub where to find your .html files. Deployment Branch

  4. In your GitHub Desktop, clone your new repository onto your laptop.

  5. Move all the contents of your basic template website into the cloned folder!

  6. In your GitHub Desktop, commit and push!

Congratulations, you have made your website! ✨

Version 2

A second, more elegant version of creating a website in GitHub, without having to copy your website template into the repo. This way will allow you to create an R Project directly inside your repository.

  1. Create a new repository in GitHub, configure it for GitHub Pages in the setting and clone it onto your laptop.

  2. Open RStudio and create a new project, however, this time click the option Existing Directory, as shown in the screenshot below. Existing Directory Make sure to set your Project Working Directory to the cloned repository folder on your laptop!

  3. Now you will have a blank R Project with no Distill Website Template, but don’t fret! Just type the following line into the console, then enter your website title! Now you have a website template. Make sure to save and render_site().

distill::create_website(dir = getwd(), gh_pages = TRUE)
  1. Now the only thing left is to commit and push your changes in GitHub Desktop.

Congratulations! You have made your website. ✨

Now the only thing left is to personalize your website and to add content! Please check out the official Distill website for great step-by-step instructions on how to build the site. Please check out the tutorial from the Distillery on how to make an about me page. If you want to understand more of R Markdown, we recommend this webinar from Alison Hill and DesirĂŠe De Leon.

Sharing on Short Notice: How to Get Your Materials Online With R Markdown - RStudio