[Tutorial] Creating Academic Blog

This post reviews the procedure of creating Github Pages Website using distill package and Github Pages in a step-to-step way.

Zhang Jihong true
2022-04-24

Requirement

Following software is necessary to replicate the steps in this post:

To get started with Github, please refer to the official website. To install distill package, run install.packages("distill") in your R console.

Procedure

To create a website with the URL <username.github.io>, create the directory name with same name and same Github repo name. For example, my github repo name is “jihongz.github.io”, and it is published in http://jihongz.github.io.

Flowchart for creating websiteNecessary Files

To have your personal website, you need to have all require files for the website. The basic files for Github Pages based website with distill includes:

  1. _site.yml
  2. index.Rmd
  3. .nojekyll
  4. _posts
Example of file structure used in my github website

New Post

To create a new post, use distill::create_post() function with the name of the post. The function will create a new directory “2022-XX-XX-post-name” in the _posts folder in which there exists a Rmd file with same name. The Rmd file will be your content of the new post.

distill::create_post(title = "Tutorial of creating personal blog using distill package and Github Pages")
Files in your post folder

Open the Rmd file and make sure the header of your Rmd file is like this:

---
title: "[Tutorial] Creating Academic Blog"
description: |
  This post reviews the procedure of creating Github Pages Website  using distill package and Github Pages in a step-to-step way.
author:
  - name: Zhang Jihong
    url: {}
date: 2022-04-24
output:
  distill::distill_article:
    self_contained: false
---

After editting the Rmd file, knit the fill and then build website using Build Website button in the Build pane of Rstudio.

The Build button in Rstudio

It will then pop up your updated website in a window.

Preview of updated website

However, the website is not published yet. To publish the website, upload the files to Github. Following is a example of pushing the local files to the Github server via command line.

git add *
git commit -m "create a new post"
git push

Settings of Github Repo

Go to the Github Repo > Settings > Pages

Github Settings

In the webpage, choose _docs and you will see your website is published.

change settings

Reference

Learn more about using Distill at https://rstudio.github.io/distill.