Share the website (via GitHub pages)
- If your website has its own repo, commit and push all of the code to GitHub.
- Visit the repo on GitHub.
- Open the repo’s Settings.
- Scroll down to the GitHub pages section
- Choose how GitHub will find your site.
master branch
means that your website files are intermingled with the other files in your repo. This is fine for simple repos, but I usually prefer the second option.
master branch /docs folder
. This means that your website files are copied to a new folder called docs/
. Here’s a figure showing how the PSY 525 course website is configured.
knitr::include_graphics("img/github-pages-psy-525.jpg")
- Go back to your R site and confirm that your
_site.yml
file has the correct output_dir:
parameter.
- If you chose
master branch
for your GitHub pages, then you must specify output_dir: "."
in your _site.yml
header file. The period .
means the home or root directory for your repo.
- If you chose
master branch /docs folder
then you must set output_dir: "docs"
(no /
).
- If you change your
_site.yml
file, you must re-render the site using rmarkdown::render_site()
; commit and push the changes to GitHub.
- Wait a few moments and then visit the URL for your site. GitHub pages can take tens of seconds to do all the updating on the backend, so be a little patient.