New Blog Down

A new year, a new blogging platform!

This time I’m moving from Jekyll to RStudio’s new blogdown format.

This keeps the advantages of Jekyll (a static, high performance website; markdown for editing; free hosting on Github) but with the extra bonus of being able to render in RMarkdown plus adding some nice looking capabilities from the Hugo project.

As I blog a lot about R it makes sense to have a platform that is more R-aware, as well as it letting me do things like this:


gaid <- Sys.getenv("GA_ID")
gadata <- google_analytics_4(gaid, 
                             date_range = c("2013-08-01", "2016-07-31"),
                             dimensions = c("yearMonth"),
                             metrics = "sessions")

ga_ts <- ts(gadata$sessions, start = c(2013,08), end = c(2016,07), frequency = 12)

forecast1 <- HoltWinters(ga_ts)

## forecast for next 12 months of the blog sessions
hchart(forecast(forecast1, h = 12))

As I type R code blocks, the code output gets rendered right into the blog.

This is the example from the homepage, and adding interactive HTML widgets to my posts is going to be lovely, with no other hassle other than writing the code.

Setup blogdown

Now, blogdown is in beta so the documentation is a bit sparse at the moment, and I had some teething troubles migrating across from my old blog, but hopefully I have that all sorted now (although I never want to hear about Git submodules again).

I mostly followed the guide on Hugo about hosting on Github pages and then added the deploy script it recommends to RStudio’s custom project settings, meaning I can now publish with a click of a button:

My work flow now is:

  1. Click the “Add Post” RStudio addin
  2. Write my markdown or RMarkdown post
  3. Preview the website using the “Live Preview Site” RStudio addin
  4. Publish by pushing the “Build All” button.

For migration I had to go through and add the url field to the posts with my old URLs to preserve old links to the blog, and also turn off forced lower case via the disablePathToLower = true option in the config.toml file.

I maintain two Github repos - one with the actual site content and the other holding the Hugo configuration, if you’re interested in my setup.

I had/have a lot of hassles with git submodules, I found this StackOverflow answer helped a lot to wipe the slate clean of git submodules and start again with the Hugo instructions

Share Comments
comments powered by Disqus