Markdown is an easy-to-read and easy-to-write plain text format. Cheatsheet.
Git is a free and open source distributed version control system, a tool to manage your source code history.
GitHub is a web-based hosting service for version control using git.
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
Adding a new SSH key to your GitHub account: https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
Set up your name and email address (first time only):
install.packages("blogdown")
blogdown::install_hugo()
For macOS users, if you see error message "Error: You have not agreed to the Xcode license.", try to run the following code in terminal.
For macOS users, if you have 'Homebrew' installed, install_hugo() will use it to install hugo. It might take a few minutes.
sudo xcodebuild -license
For macOS users, if you don't have 'Homebrew' installed, install_hugo() will download the Hugo binary directly. You might see some error and warning messages, but no worries.
In Rstudio, File -> New project... -> New directory -> Website using blogdown.
Hugo themes: https://themes.gohugo.io/; rbind
We use hugo theme "gcushen/hugo-academic" in this demo.
Use the following R code to create a new site if you are not using Rstudio.
blogdown::new_site(dir = "./blogdown_test", install_hugo = TRUE, format = "toml",
sample = TRUE, theme = "gcushen/hugo-academic", theme_example = TRUE,
serve = interactive())
In Rstudio, Addins -> Serve Site
Or in R terminal, run 'blogdown::serve_site()'.
Although you can choose to create a new post in Markdown format or R Markdown format, highly recommend you to always use R Markdown, even if your document does not contain any R code chunks.
Restart the R session, and run blogdown::hugo_build(). You should get a 'public' directory under the root directory of your project.
Log into https://www.netlify.com, drag and drop the 'public' folder to the indicated area on the Netlify web page.
Other deployment methods: https://bookdown.org/yihui/blogdown/deployment.html