Here are some recaps of the workshop on how to set up your website in R Markdown and GitHub.
Version 1
Make a new R Project by clicking on the New Project button.
Click on New Directory, than select Distill Website from the list.
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.
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.
Go to GitHub and create a new repository. You can click on the plus button on the top right corner.
Give your new repository a name, add a README file and .gitignore like shown in the screenshot below. Then create!
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.
In your GitHub Desktop, clone your new repository onto your laptop.
Move all the contents of your basic template website into the cloned folder!
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.
Create a new repository in GitHub, configure it for GitHub Pages in the setting and clone it onto your laptop.
Open RStudio and create a new project, however, this time click the option Existing Directory, as shown in the screenshot below. Make sure to set your Project Working Directory to the cloned repository folder on your laptop!
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)
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