Making Hugo-Academic Blog post in RStudio

It seems like Hugo academic and RStudio should play well together, but I can't get it to work.
I produced a website outside of RStudio, following the instructions to use github installation on the academic theme deployment page. The site is live ( and it works fine.
But I can't figure out how to write a blogpost in RStudio that hugo will then compile.

I write a blogpost in an .rmd file in RStudio.

title: test
author: Simon
date: '2018-03-04'
slug: test
categories: []
tags: ['Test']


And when I knit to Markdown (.md file) , this is what I get. Note the absence of any TOML metadata.



When I compile the website from terminal after knitting to Markdown I get this:

Building sites … ERROR 2018/03/03 19:41:23 Error while rendering "home" in "": template: theme/index.html:1:3: executing "theme/index.html" at <partial "widget_page...>: error calling partial: template: theme/partials/widget_page.html:23:9: executing "theme/partials/widget_page.html" at <partial $widget $par...>: error calling partial: template: theme/partials/widgets/posts.html:61:51: executing "theme/partials/widgets/posts.html" at <len .Params.tags>: error calling len: len of untyped n

When I delete the md file that I knit, the website compiles fine.

The blog post examples seem to require TOML metadata, i.e.

+++ Metadata +++
But the blog posts in RStudio seem to use YAML metadata



Is this the problem? Do I need to redesign the website using blogdown and installing the academic theme from within RStudio?

1 Like

Are you knitting, as in using the knit button? If so, then you should switch to running blogdown::serve_site(), and be sure to delete whatever artifacts you're getting from knitting.

Re. configuration and TOML vs. YAML, see the blogdown book here (it links to the correct section, that just doesn't show up in the preview box):

I can't tell from the error, but is it possible you don't have the theme imported correctly?

Re. whether or not to troubleshoot, or re-build from RStudio with the recommended workflow, that's totally your call. You shouldn't have to, but sometimes it is easier to start from scratch. ¯\(°_o)/¯

I rounded up a bunch of blogdown posts I've found helpful here, if you're looking for more pointers (I don't actually offer any helpful advice, just links to people/posts that do!):


Your first suggestion nailed it. I am such a happy camper now. Thanks!

Awesome! Would you mind just marking this as solved (as described in the FAQ I'm linking to below).