I am writing this because I forget myself how to do this. I set up this blog through GitHub following the instructions provided by Robert Myles. Now when I want to make a new post I do the following
1. Opened RStudio to my website-hugo project.
2. Create a new post
The posts are created and built using the R package blogdown. To create the new post, I use blogdown::new_post(title='<insert post name here>', ext='.Rmd')
. Using ext='.Rmd'
makes it a .Rmd file instead of a .md file. This argument used to be rmd=T
, but was changed sometime in the last 4 months.
3. Serve site
Use blogdown::serve_site()
to evaluate the .Rmd file and make it a .html file.
Do not use blogdown::build_site()
. This will rebuild all previous posts, too, which is not wanted. This was especially bad since I no longer had my TensorFlow working, so it failed.
4. Commit files to Git
5. Commit public folder to Git
This part is a little bit complicated, or at least it is usually what causes me trouble. I use GitKraken to manage my Git repositories. In GitKraken I have to open the public folder by clicking on “Open submodule: public.”
This is where I always have trouble, for some reason if I commit the changes it doesn’t always work. I think the key is that in the top bar I have to change “HEAD” to “master.” Then I commit all the changes. Sometimes if I change to a different project and then back to website-hugo in GitKraken, the public folder will still be there uncommitted. I think changing “HEAD” to “master” fixes this, but if it doesn’t then I usually just try redoing the commit and trying variations until it works.
Assuming the commit works, this copies the changes over to my github.io Git project, and it should show up on my blog right away. Nothing needs to be edited or committed in my CollinErickson.github.io Git repository since it is connected to the website-hugo repo throught the public folder.