TIME: ⏱ 10 minutes
First, make sure you have the latest version of the distill package installed from CRAN:
Restart your R session. If you use RStudio, use the menu item Session > Restart R or the associated keyboard shortcut:
- Ctrl + Shift + F10 (Windows and Linux) or
- Command + Shift + F10 (Mac OS).
packageVersion("distill")  ‘1.2’
We’ll follow a “New Project, GitHub first” workflow.
Go online to your GitHub account, and create a new repository and YES initialize this repository by adding a
We just created the remote repository on GitHub. To make a local copy on our computer that we can actually work in, we’ll clone that repository into a new RStudio project. This will allow us to sync between the two locations: your remote (the one you see on github.com) and your local desktop.
Use the RStudio IDE project wizard:
Open up RStudio to create a new project where your website’s files will live.
File > New Project > Version Control > Git.
Paste the URL from GitHub (either HTTPS or SSH).
Be intentional about where you tell RStudio to create this new Project on your workstation.
Click Create Project.
Alternatively, do this (but note that it requires a GitHub personal access token):
usethis::create_from_github("apreshill/iyo-distill", destdir = "/Users/alison/rscratch")
Everyone - all together now!
Use the RStudio IDE to commit and push these files:
Inside your current distill project, use the R console:
Let’s start with a simple website:
create_website(dir = ".", title = "iyo-distill", gh_pages = TRUE)
Now, let’s commit all these new files and push to GitHub.
Please close the RStudio IDE and re-open it. Look in your Git pane, you should see a single file has changed:
Let’s look at the diff:
Let’s go ahead and commit this file before we start adding to our site.
You should now see a Build tab that looks like this:
Click that 🔨 Build Website button, and explore your site!
Now, delete your
about.Rmd (trust me!). We’ll create a new one with the postcards package.
postcards::create_postcard(template = "jolla", file = "about.Rmd")
This time, 🔨 Build Website instead of knitting 🧶.
You should be able to now see your new “about” page.
_site.yml controls this- you can add and remove pages here.
Also note, here is your output format:
And here is your output directory (i.e., when you build the site, all the HTML files go here):
We want to publish the “/docs” folder.
Publish to GitHub pages
> usethis::use_github_pages(branch = "main", path = "/docs") ✓ Setting active project to '/Users/alison/rscratch/iyo-distill' ✓ Activating GitHub Pages for 'apreshill/iyo-distill' ✓ GitHub Pages is publishing from: ● URL: 'https://apreshill.github.io/giyo-distill/' ● Branch: 'main' ● Path: '/docs'
Add it to your repository details ❤️