blogdown Part I: Launching a New Site

[This article was first published on Ye Olde R Blog Grogram, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


  • A basic workflow to set up an R blog using blogdown.
    • Create using the Hugo theme Tranquilpeak (v0.4.3).
    • Host static website on Netlify
    • Source files stored on github
    • Configured so that RSS feed can be shared with R-bloggers


Instructions here will rarely be explicit. These workflows are essentially notes for experienced users to help remind them of the minimal steps to complete the task at hand.


  • Strongish familiarity with RStudio, R packages, and R projects
  • Medium familiarity with git and github
  • Some familiarity with blogdown
  • Installation of R, R-Studio, blogdown, and all associated dependencies
  • A Netlify account linked to Github


  • Start project
    • RStudio toolbar:
      • File -> New Project -> New Directory -> blogdown website
      • Copy kakawait/hugo-tranquilpeak-theme into the Hugo theme field
  • Version control
    • RStudio toolbar:
      • Tools -> Project Options -> Version Control -> select git
    • Add the line public to .gitignore
    • Track all project files:

      git add --all
      git commit -am "First commit"
    • Create a new repository on github
    • Link local repo to remote repo:

      git remote add origin [email protected]:username/blogname.git
      git push -u origin master
  • Nelify
    • Add following line to config.toml file:
      • ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"]
    • Go to Netlify and select New site from Git
    • Set the following options:
      • Build command: hugo
      • Publish directory: public
    • Change build variables:
      • Find local hugo version blogdown::hugo_version()
      • Settings -> Build and Deploy -> Build Environmental Variables
      • Set key -> HUGO_VERSION and value -> 0.42.1 (or the appropriate version)
    • Change to desired site name:
      • On Netlify: Settings -> Site details -> Site information -> Site name
  • config.toml
    • Update baseURL to netlify address
    • Make other changes as desired
  • RSS feed
    • Note: By default, the RSS feed for Tranquilpeak is set up to display article summaries, which will not allow automatic uploading to R-bloggers. A solution (reproduced here) can be found on the blog: cool but useless
    • Create the file rss.xml in the following directory:
    • themes/hugo-tranquilpeak-theme/layouts
    • Copy and paste the following text into this file (unmodified version here):

      <rss version="2.0" xmlns:atom="">
          <title>{{ if eq  .Title  .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
          <link>{{ .Permalink }}</link>
          <description>Recent content {{ if ne  .Title  .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
          <generator>Hugo --</generator>{{ with .Site.LanguageCode }}
          <language>{{.}}</language>{{end}}{{ with }}
          <managingEditor>{{.}}{{ with $ }} ({{.}}){{end}}</managingEditor>{{end}}{{ with }}
          <webMaster>{{.}}{{ with $ }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
          <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
          <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
          {{ with .OutputFormats.Get "RSS" }}
              {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
          {{ end }}
          {{ range .Data.Pages }}
            <title>{{ .Title }}</title>
            <link>{{ .Permalink }}</link>
            <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
            {{ with }}<author>{{.}}{{ with $ }} ({{.}}){{end}}</author>{{end}}
            <guid>{{ .Permalink }}</guid>
            <description>{{ .Content | html }}</description>
          {{ end }}
    • Potential alternative solution by Thug R Life

  • Add description to .Rmd posts

    • Note: posts created using .Rmd documents will be formatted awkwardly on the homepage (by default, show the first 70 lines all combine into one paragraph). github user Joseph Chou (jhchou), posted a solution that works for Tranquilpeak v0.4.3-BETA.
    • Navigate to themes\hugo-tranquilpeak-theme\layouts\_default\summary.html
    • Find line 43 – {{ .Summary }}
    • Replace with:

      {{if .Description }}
        {{ printf "%s" .Description }}
      {{ else }}
        {{ printf "%s" .Summary | markdownify }}
      {{ end }}
    • This will allow you to add summaries via the .Rmd post YAML header that will display the first 70 lines

      title: "Test post 2"
      author: ''
      date: '2018-06-19'
      slug: test-post-2
      categories: []
      tags: []
      description: "a description"
  • Deploy website
    • Netlify will build website in public upon push to github.

Other themes

This workflow was written with the Tranquilpeak theme in mind. However, other suitable themes may be found here:

To implement another theme, when starting a new blogdown website, identify the user name and rep of the desired theme, and use this as prompted when starting a new website using the File menu in RStudio.

To leave a comment for the author, please follow the link and comment on their blog: Ye Olde R Blog Grogram. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)