Blog not down
It has been one year since my last article, and here is a quick post indicating that my blog is not down. Instead, it has a new look thanks to blogdown. Yes, pun intended. :-)
blogdown, mostly written by Yihui, is an R package that can help you rapidly create a static blog or website. The package name has nothing to do with the status of a website (as in “the server is down”), but rather follows the convention of other Markdown-based packages such as rmarkdown and bookdown. (As for the name of Markdown, I suspect that it was chosen such that it looked differently from other popular markup languages at that time such as HTML.)
- The installation is very easy. In fact, it provides a single executable file for most mainstream operating systems.
- The blogdown package simplifies this process even more.
- Hugo has a decent theming system, and more importantly, it provides a mechanism with which you can import themes developed by others and make your own modifications without messing up the code.
As I mentioned above, blogdown simplifies the procedure of installing Hugo, downloading a theme, and creating a new site. The following three lines are sufficient for initiating a new blog:
library(blogdown) install_hugo() ## run once new_site(theme = "kakawait/hugo-tranquilpeak-theme")
theme parameter is optional since it has a default value
theme = "yihui/hugo-lithium-theme".
The value I specified will use the theme at
(thanks to the theme author!). Then you get a directory of Hugo source files,
and the generated static HTML pages in the
Note that unlike Jekyll blogs that can be directly rendered by Github Pages, Hugo blogs are not yet supported by Github. But fortunately, you can deploy your blog on Netlify by linking a Github repository. There is a nice article talking about this.
For me, the next major steps to fully migrate the blog to Hugo were as follows:
*.mdfiles to the
contentfolder of Hugo site.
- Making my customizations of the theme under the
layoutsfolder. The layout files under this folder have higher priority than the imported theme files, so you can easily override some theme functions without polluting the upstream.
- Files in the
staticfolder will be located in the website root directory, for example CSS and images.
- Push the directory to Github and link to Netlify.
- Point the domain name to the new server address as described in this document.
So far all of my posts are plain Markdown files, meaning that they are not dynamic documents that contain executable code. But in fact another attractive feature of blogdown is to allow you writing R-Markdown-style blogs that can be automatically compiled into Markdown with the rendered output. At the time of writing the blogdown package is under active development, and hope its first formal release goes to CRAN soon.