Source Blogdown files for the corelab.io website
This repository contains the source files for the CORE Lab webpage (corelab.io).
The site is built in the Blogdown R Package and this repository stores the source Blogdown files. Netlify.com then "knits" the files into .html and other web-compatible files that are published.
The workflow to edit the webpage is to fork the files to your GitHub account, clone the files locally, make any edits, commit the changes back to your GitHub account, then submit a "Pull Request" to the main co-relab/co-relab_source branch on GitHub.
Basic steps for CORE lab members to edit the webpage:
- Ensure you have R and R Studio installed.
- Create a GitHub account.
- Fork the repository into your own account:
- If necessary, Install Git (comes with MacOS by default)
- Clone (e.g., download the files and create a Git repository on your local hard disk) the repo locally. To do this, first go to the forked repository on GitHub, click the "Clone or Download" button, copy the link.
Open a Terminal (or cmd prompt), navigate to where you want the files to be stored on your hard disk (use the 'cd' command in Terminal, which changes your directory), and run:
git clone <copied url>
<copied url> with your clipboard.
This will create a new directory on your computer: co-relab_source
- Navigate on your computer to the new co-relab_source folder and open co-relab_source.rproj in R Studio.
- Also open co-relab_source_rscript.R (the R script). Using R Projects eliminates the need to set a working directory each time (it's automatically set to the folder containing the .rproj file).
- In the Terminal of R Studio (or your regular command line), configure the remote repository so you can update your local files with changes from the main repo:
git remote add upstream https://github.com/co-relab/co-relab_source.git
- Each time before you start editing the page, update your local repo and resolve any conflicts:
git fetch upstream
git checkout master
git merge upstream/master
If you get conflicts you will have to resolve them before it will let you merge. IF you want to overwrite your local changes with the main repo
you can "stash" your files like this:
git stash save --keep-index
If you don't want to keep your stashed files, drop them:
git stash drop
- At this point, just follow instructions in the R script to edit the page.
- Once you're done, you'll "Commit" those changes back to your local repository using the "Git" window in R Studio: Checkbox the files you want to commit (usually all of them), then press "Commit". Write a commit message that explains what changes were made, and press "Commit" in the new window.
- Then, to "Push" these changes back to your fork on GitHub, press the "Push" button in R Studio.
- Finally, submit a "Pull Request" to send these changes back to the original repository and make them live on the webpage: go to GitHub.com, login on your account, and submit a "Pull Request". After this, a website admin (Rick or Hans, at the moment) needs to login to the 'co-relab' GitHub account, and merge the pull request.
Note: You need to be authenticated to your GitHub account on your pc or it will give you an error.