I am very excited that I can start writing blogs with Markdown (even better, Rmarkdown), and then push the posts to GitHub. Then done!! The posts will show up at https://zhenguozhang.zone/ hosted at https://netlify.com. I don’t need worry deployment of the website.
For this to work, I used the excellent R package blogdown, written by the R celebrity Yihui Xie. Since the process is so amazing, I would like to share it with you, so you can also benefit from it.
Steps
-
Install the package blogdown in Rstudio by typing:
install.packages(“blogdown”)
|
|
-
Deploy the website to netlify.com. Go to the website https://www.netlify.com/ to sign up a free account, and link your github repository to create a website. See https://www.netlify.com/blog/2016/09/29/a-step-by-step-guide-deploying-on-netlify/ for step-by-step guide. When configurating the settings, keep “Branch” as “master”, “Dir” as “public”, and “Build command” as “hugo”.
-
Enjoy your website and blogging. 😄
Afterword
- You may fail in the deployment. If this happens, that may be caused by the lower version of hugo used by netlify. To solve this, add a file “netlify.toml” in the root of site folder “test-blog”, and put the following code in it:
|
|
Then commit and push the changes to github, and check the deployment in a couple of minutes.
-
You can see Yihui’s talk on blogdown at https://www.rstudio.com/resources/videos/create-and-maintain-websites-with-r-markdown-and-blogdown/ In the talk, he also demonstrated how to type SUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUPER fast using HHKB.
-
The blogdown is built on hugo, an automatic static site generator, so you may learn it if you want to configure the website better.
-
Actually, I tried to build my blog firstly with hugo directly by following the instruction at https://github.com/netlify/victor-hugo and https://www.netlify.com/blog/2016/09/21/a-step-by-step-guide-victor-hugo-on-netlify/, but I failed during rendering the website, possibly because the files are too old to be used by the lastest software.
-
I started to use blogdown because of the inspiration from Peng Zhao and Yixuan.
Please write me if you have any comments or questions.
Last modified on 2018-07-27