Migrating to Blogdown-Hugo


After 3 or so years with Octopress, I’m moving my blog/website over to Hugo with the help of the new Blogdown R package. It had gotten to be a little absurd how much work I had to do to twist rendered RMarkdown documents into Octopress posts. Thankfully, Yihui Xie was already on the job of making my ridiculous blogging workflow obsolete.

Less than 48 hours after learning of Blogdown’s existence I’m well on my way to having my blog fully migrated and the words in my .Rmd files flowing effortlessly from my keyboard to the web.

Most likely I’ll have more on this stuff later, but for now I’ll just post an in-progress list of things I’ve done in the course of the migration that I or others might find useful in the future.


Herein I’m documenting the steps I’m taking in migrating from Octopress/Jekyll to Blogdown/Hugo. Unfortunately I didn’t think to do this until some way into the process.

  1. Consult the Blogdown readme
    • Install the package from github.
    • Do the other things on the readme.
    • Pick out a theme. I chose tranquilpeak.
  2. Check the migration guide from the blogdown devs. Nothing there at the moment, but I get the sense that this guide is in pretty rapid development.
  3. Sign up for a gravatar. Not at all necessary, but it looked like a cool thing so I did it.
  4. Various tweaks to the config.toml file.
  5. Modify workflow to do everything while server daemon is running. No more knitting individual blog posts.
    • Add options(servr_daemon = TRUE) to project .Rprofile
    • Use “Serve Site” addin, or blogdown::serve_site()
  6. Use the “Update Meta” addin to update the yaml.
    • If you have a single category or tag, like categories: [meta], make sure you have the square brackets or the site won’t generate.
  7. Include tables of contents in your post.
    • Just like with typical Rmarkdown specification in yaml front matter, but use blogdown::html_page: instead of html_file:
    • More info here and here
  8. Get MathJax working, so that pages like this render properly.
    • See this discussion
    • Follow this advice
      • Edit footer.html in themes/[yourthemehere]/layouts/partials/ using either the html snippet linked in the parent bullet or the one provided by Lauler in the bullet above that.
      • But apparently this approach “has a potential problem” whatever that means.
  9. Deploying: Must deploy to root on remote, otherwise links will fail (e.g. images).
  10. Add thumbnail images to your posts using the thumbnailImage: yaml tag. E.g. thumbnailImage: '/img/mythumb.png'
Mark Hagemann
Post-Doctoral Researcher

I use statistics to learn about rivers from space.