Creating Distill Blog in R


This is a tutorial on how you can use Distill to host blog in R. Before the end of this article, you’ll also learn to create, build and host your own website/blog using R.

Binod Jung Bogati

Since last 4 years, I had been using WordPress for hosting my blogs. It is great platform for beginners to begin with blogging. However, I have migrated from WordPress to Distill blog.

What is Distill?

Distill is a web publishing format used for scientific and technical writing. Using Rmarkdown, you can create a distill blog or website.

Why use Distill for Blog?

Distill is based onDistill web framework. It combines the technical writing features of Distill with R Markdown. You’ll find distill awesome because they’re:

You can find more detailed about the distill featureshere.

Steps for Creating/Hosting Distill Blog

You can easily create and host Distill blog in R using RStudio.

1. Install Distill R Package

First, you need to install Distill R package.


2. Create a Distill Project

Now on your RStudio (top-left), File > New Project > Create Distill Blog.

You can configure your blog setting with_site.ymlfile.

name: "Binod Jung Bogati" 
title: "My Data Science Blog"
description: |
  Hi, I'm Data Scientist at Numeric mind. This is my blog about Rstats and Data Science.
output_dir: "_site"
    - text: "Home"
      href: index.html
    - text: "About"
      href: about.html
output: distill::distill_article

3. Creating Distill Blog Post

You can create new distill blog post using create_post() function. To skip date prefix (10-01-2021), you can set it to NULL as below.

distill::create_post("Creating Distill Blog in R", date_prefix = NULL)

After that, distill will generate Rmarkdown file inside a folder. You can change your name and add content in your post.

Once you’re done with changes, you may knit your article/post (Ctrl+Shift+K).

You can open index.Rmd file from Files (right-bottom). Then knit the index.Rmd file to generate a Home page (index.html).

Note: All the blog posts are located at the **_posts** directory.

4. Setup Distill Repository

We are going to create GitHub Repository for our distill blog. This is because, we can update our blog withgit push.

- Go to Tools > Terminal > New Terminal (Alt+Shift+R). Then, push all your changes to GitHub.

You can refer guide toupload project in GitHub.

git add .
git commit -m "added new blog"
git remote add origin
git push -u origin master

5. Host Your Distill Blog

We can easily host our distill blog, once it’s available on GitHub repository. Here, we’re going to use Netlify (instead of GitHub Pages).

Customize Distill Blog

In Distill, you can customize your blog theme with style.css.