Communicating CT Research via Website Development with R

Photo by Clément H on Unsplash


Overview & Learning Objectives
Getting Started
Build Your Site
Other Pearls


  • Almost everyone in Academia these days has a website. Indeed, websites are a fabulous way to post content and more effectively communicate your Clinical and Translational Research.
  • There are many tools and services that can assist you in developing a very functional website.
  • This working document is a rough user guide on how to create a website using R via a package called blogdown. It will also walk you through opening in account on Netlify, which will host your website.
  • There are numerous resources for webpage development, including an amazing bookdown called “blogdown: Creating Websites with R Markdown” ( We’ve created this resource as we have tried to provide details and pearls that we struggled with and we belive these may be helpful to others.
  • This is a ongoing, ‘living’ document that is constantly being edited and expanded. Please provide comments to allow us to optimize this document for all R users.

Getting Started

Load Packages for RMarkdown



  1. Register a GitHub account (
  2. Create a new Repository (“+” sign in the upper right hand corner)
  3. Create a name for the repo and remember this as it will be used
  4. Copy the github repo address


Starting Your Project

  1. Create a new project in R using version control
  • File -> New Project -> Version Control -> Git (clone a project from a Git repository)
  • Enter the Git Repository URL:e.g.
  • Create Project (open in new session would be my recommendation
  1. Install blogdown
if (!requireNamespace("devtools")) install.packages("devtools")
  1. Load blogdown
  1. Create a new_site
  • this will install Hugo and download new files
  • The default theme is lithium
  • If you want a different one (e.g. hugo-academic) add the following into the function:
new_site(theme = "gcushen/hugo-academic")
  • Once you do this it will download all of the necessary files into your working directory
    • for example:


Use the function build_site() in the blogdown package




This function allows you to serve your website locally so you can view it in the “Viewer” tab in the “Files Plots Packages Help Viewer” pane ## Commit Changes to GitHub 1. Once you’ve set up your version control to github, each change that you make will be tracked by R. These changes will be cataloged in the Git Pane.

  1. To commit them to GitHub, select all of the files and click on one of the check boxes.

  1. Then click on the “Commit” button in teh above pane
  2. That will bring up a new window which will allow you to review the changes you’ve made. Write a message in the “Commit Message” Box in order to annotate the changes.

* Of note, these changes will show up in GitHub under “Commit”.

  1. Then press “Commit”. After you do that a new window will pop up called “Git Commit”.

  1. Then press “Close”. Press “Push” in the Review Changes Pane, which will push the changes to GitHub. This window will pop up. Once it has been pushed, press “Close”. That should be it.



  • Netlify is a is a San Francisco-based cloud computing company that offers hosting and serverless backend services for static websites (source:
  • There are other options. We’ve used it to host our website.
  • Here are a few steps to get started:
  1. Go to netlify ( and sign up
  2. We would recommend signing up with your GitHub account, especially if your are doing to deploy your website from this account
  3. Launch a New Site from Git
  4. Select Continuous Deployment from GitHub
  5. Pick your GitHub Repository for which you want Continuous Deployment
  6. Modify Settings (here’s an example)

7. Select Deploy Site 8. Select a Domain Name (you can purchase one from Netlify if it is available)

Designing a Website Using Hugo Academic


Configurating the Website


  • There are several config files that you need to know about


  • This file is where you will create the Title of your website
    # Title of your site
    title = “The Miller Lab”


  • Location
    • config/_default/params.toml
  • This is where you will control which items such as
    • Logo
    • Contact Details (email, addresses, etc)
    • Social Media Details
    • Configuration of publication pages
    • Marketing such as Google Analytics

Widgets in Hugo Academic


  • The academic theme has lots of widgets; these are in your home folder; look for “active = “ and assign true or false depending on whether or not you want them “active = false” will hide the widget
  • The Hugo project uses +++ to denote demarcation for TOML documents. It is a way for them to have a single text file that consists of TOML in the “frontmatter” (document meta-data), and a second “document” that is the body of page content.

Octicon-start and Get Started Clicker

Hero widget

  • This is the first widget worth adjusting
  • This is where you change the title of the website
  • content -> home ->
  • Within the TOML, you can add text using
    label = ‘Latest release

url = “
label = “Get Started”
icon_pack = “fas”
icon = “download”

url = “
label = “View Documentation”

People Widget

  • Under content -> Home ->
  • This will allow you place a “Meet the Team” segment on the web page
  • User_groups = [ ] is key
  • Within the [ ] you should specify the names of the subfolders in the “authors”
  • For example
    • Choose which groups/teams of users to display.
    • Edit user_groups in each user’s profile to add them to one or more of these groups.
    • user_groups = [“Fellows”, “Students”]
    • Fellows and Students are the strings that you use in the files within each persons folder. “Authors” wd -> content -> authors
    • What I did was create a subfolder of each person in “Authors” wd -> content -> authors
    • For example wd -> content -> authors -> John-Doe
      • Then with the subfolder “John-Doe” the info for the site is placed in a .md or .Rmd file called or _index.Rmd.
      • Then you list the person’s user-group accordingly and they will show up under that heading.
      • Within the ` file, use the following
    • authors:
    • John-Doe
  • Then when you want to “tag” that person in say a post or a talk, you can write “- John-Doe” in under the authors: section of the YAML in that specific posting or talk

Talk Widget

  • To edit content go to content -> talk

    • Then edit
  • Example code that was embedded in default Talk widget page

    Click on the Slides button above to view the built-in slides feature.

  • Slides can be added in a few ways:

    • Create slides using Academic’s
      Slides feature and link using slides parameter in the front matter of the talk file
    • Upload an existing slide deck to static/ and link using url_slides parameter in the front matter of the talk file
  • Example from the miller lab website

    • I created a folder in “static” called “slides”
    • Then I put the pdf of “MIG_3-1-19.pdf” in that folder
    • Then in the file under content->talk->MIG_3-1-19 I used the following
      url_slides: “slides/MIG_3-1-19.pdf”
    • I also removed “example” from line 29
    • Slides: “ ”
    • This was key, otherwise it didn’t work
  • Embed your slides (e.g. Google Slides) or presentation video on this page using shortcodes.

  • Further talk details can easily be added to this page using *Markdown* and $\rm \LaTeX$ math code.

  • In the new folder you created you will need a file and potentially a features.jpg

  • Then make edits the prn

Projects Widget

  • Md document is in the Home folder “”
    • content -> home ->
  • There is a built in mechanism to link your active projects
  • The details for your project, however is located:
    • Content -> project
    • Within thei “project” folder you can add new subfolders of the different ongoing projects
  • Toolbar
    • There is a tool bar feature that you can edit, e.g.
      name = “Data Science”
      tag = “data-science”
  • projects subfolder
    • As mentioned above, the actual descriptions of the projects are in
    • Content -> project
    • Here’s an example
    • Content -> project -> data-science
  • With the “data-science” subfolder, there are two key files
    • Featured.jpg (the picture that will be feature)
  • for projects
    • Here put the data you want in the YAML
  • Pay attention to
    • Tags:
    • -data-science
    • This will link this file to the tool bar in the projects page

Talks Widget


  • “Presentations” in the menu ribbon are edited with the talks widget
  • The content of those presentations is stored in the “talk” folder
    • Location of that folder: content/talk
  • Then create new folders in that “talk” folder, each of which represents a new presentation that you’ve given

Below is the canned Text that comes as a default

abstract: Lorem ipsum dolor sit amet

city: Stanford country: United States postcode: “94305” region: CA street: 450 Serra Mall
all_day: false
authors: []
date: “2018-06-01T13:00:00Z”
date_end: “2018-06-01T15:00:00Z”
event: Academic Theme Conference
featured: false
caption: ‘Image credit: Unsplash’ focal_point: Right
links: - icon: twitter icon_pack: fab name: Follow url: location: Source Themes HQ math: true projects: - internal-project
publishDate: “2017-01-01T00:00:00Z”
slides: example
summary: An example talk using Academic’s Markdown slides feature.
tags: []
title: Example Talk
url_code: ""
url_pdf: ""
url_slides: ""
url_video: ""

Click on the Slides button above to view the built-in slides feature.

Slides can be added in a few ways:

  • Create slides using Academic’s Slides feature and link using slides parameter in the front matter of the talk file
  • Upload an existing slide deck to static/ and link using url_slides parameter in the front matter of the talk file
  • Embed your slides (e.g. Google Slides) or presentation video on this page using shortcodes.

Further talk details can easily be added to this page using *Markdown* and $\rm \LaTeX$ math code.

Netlify TOML

  • I Ran into a problem where I could not deploy from GitHub to Netlify

  • I ran the error message into google and Alison Hill recommended that I create a netlify.toml


  • The key was addint the hugo_version to the latest version I was workin on (see below)

  • Created netlify.toml in R in the workin directly (see content below)

  • I then pushed it to GitHub and was all set!

  • This is the code I got from Alison Hill’s website

    publish = “public”
    command = “hugo”

    HUGO_VERSION = “0.59.1”
    HUGO_ENV = “production”

    HUGO_VERSION = “0.59.1”

    HUGO_VERSION = “0.59.1”

    command = “hugo -b $DEPLOY_PRIME_URL –buildFuture”

    command = “hugo -b $DEPLOY_PRIME_URL –buildFuture”`

Adding images to your website

  • I added an img folder to the home folder and placed the file images in that folder
  • Then within the Rmd file within the home folder I used this code
  • ![](/img/DMM_pic.jpg)
  • Another way to do so is to use the knitr function include_graphics(), as follows:

### Link to a PDF of your resume/CV from the menu
* To enable, copy your resume/CV to static/files/cv.pdf and uncomment the lines below
* Direct the navigation bar to your CV by editing the menus.toml file
* Wd -> config -> _default-> menus.toml [[main]]
name = “CV”
url = “files/DMM_CV.pdf”
weight = 70


  • There is a folder “post” in the "content folder that allows you to post additional pages. Within that folder you can create various subfolders with their own and Of note, if you turn off the post widget, they can still show up on your people posting if you put in your YAML under authors: the appropriate label.
Sophia Shalhout
Cutaneous Oncology Research Fellow

My research interests include clinical and translational research in advanced skin cancers.