This post is still under development! I get back to completing this whenever I find spare time.

Introduction

This presentation is made thanks to the detailed description from Matteo Courthoud.


For more detail please checkout his post!

Step 0: The requirements

  1. A GitHub account
  2. R
  3. Git
  4. Rstudio

Step1: Create a GitHub repository

  1. Go to your GitHub page and make a new repository (click on + button).

  2. Then name the repository username.github.io where username is your Github username.

Step2: Install Blogdown and Hugo in R


Switch to Rstudio and type the following:

# Install blogdown
install.packages("blogdown")

# Install Hugo
blogdown::install_hugo()

Step3: Create a local project repository


In Rstudio, go to the files, click on New Project and select New Directory.

Step4: Setup the local website

  1. Select blogdown website

  1. Select the theme for your website

Step4: Setup the local website

You can select any other theme you like such as:

  • gcushen/hugo-academic or
  • caressofsteel/hugo-story.

Step5: Build your website

In the console, type:


You should be able to see this message:

blogdown::hugo_build(local=TRUE)

Step6: Preview the website

To preview the website, type the following in RStudio:

blogdown::serve_site()

Step7: Publish your website (1/2)

Firstly, please go to config.yaml and change the baseurl to the url of the webpage you would like to publish into.

Step7: Publish your website (2/2)

Now, you need to push the contents of public/ folder to the GitHub repository.

# Go to the directory of the /project/public/
cd projectPath/public
# Init git in the /project/public/ folder
git init
# Add and commit the changes
git add --all
git commit -m "first version of the website"
# Set origin
git remote add origin https://github.com/username/username.github.io.git
# Rename local branch
git branch -M main
# And push your updates online
git push -u origin main

Voila!

🥳🥳🥳

You got yourself a cool website!

Questions?



Reference