Deploy a Blogdown site to Aerobatic

February 24, 2017

Blogdown is a RStats package, created by Yihui Xie, that acts as a wrapper for the awesome Hugo static site generator. In this tutorial, we'll show you how to create a simple blog in RStudio using blogdown and then quickly deploy the resultant website onto Aerobatic's global Content Delivery Network.


We'll assume you already have the following installed on your machine:

Step 1: Setup

In RStudio, we'll enter the following:


Step 2: Create Site

It's important to note that blogdown::new_site() requires an empty directory. So, when you setwd() earlier, make sure that directory is empty. Continuing in RStudio:

blogdown::new_post('Using Blogdown and Aerobatic to Publish A Blog About RStats')
options(servr.daemon = TRUE)

At this point, we have a new site, we've created a new blog post, and we're now serving the site up locally. When you created a new post, RStudio automatically opened a new tab with a basic post that contained some front matter. We're now going to go ahead and edit that R markdown file.

Step 3: Edit R markdown file

title: Using Blogdown and Aerobatic to Publish A Blog About RStats
date: '2017-02-23'
draft: false
```{r setup, include=FALSE}
knitr::opts_chunk$set(collapse = TRUE)
We can do a lot with blogdown and Aerobatic!

# This is a plot
```{r fig.width=7, fig.height=4, echo=FALSE}
ggplot(mpg, aes(x = displ, y = hwy)) +

# This is some code
```{r mpg}
fit <- lm(hwy ~ displ, data = mpg)

Step 4: Deploy to Aerobatic

In RStudio, go to Tools > Shell. This will open up the command line utility. Make sure you are in the root folder of your new blog. Assuming you've already installed the Aerobatic CLI:

$ aero create
$ aero deploy -d public

You'll see output like this:

Deploy new Aerobatic website version to stage production

  Compressing website assets
  Uploading archive to Aerobatic
  Waiting for cloud deployment to begin
  Cloud deployment in-progress

Version v1 deployment complete.
View now at

At this point, our site is now live on the Internet at, and as you can see, our code and plot are nicely embedded in the page.

Next Steps

From here, we could perhaps decide to password protect our site. Another option might be to take things a step further and set up Continuous Deployment (CD) with a tool like Travis or Bitbucket Pipelines. Indeed, this tutorial shows how to set up CD for a Hugo site using Bitbucket Pipelines, and this tutorial shows how to set up CD with CircleCI.