Member-only story

Distilling a website

To accompany my book, I created a website using the distill package.

Anthony B. Masters
3 min readOct 10, 2021

With David Spiegelhalter, I co-authored a book of Covid-19 statistics. For the book, I wanted to create a website hosting the graph code, reviews, and purchase links. Some elements of this site remain a work in progress.

Using R Markdown, one package and limited coding can produce a site. This site had several specifications:

  • Several different pages.
  • A navigation bar linking to these pages.
  • The ability to host images and link to code.
  • Customisation of fonts and colours.
(Image: Covid by Numbers GitHub pages site)

Creating the website

After setting up the GitHub pages site, you can create a new site in a single command:

library(distill)
create_website(dir = "my-website", title = "My Website")

That code makes three files: a home page, an ‘about’ page, and a configuration file. We should look at the configuration for the accompanying website:

name: "covid-by-numbers"
title: "Covid by Numbers"
description: |
Covid by Numbers
output_dir: "docs"
navbar:
logo:
image: images/logo.png
href: https://covid-by-numbers.github.io/
right:
- text: "Code"
menu…

--

--

Anthony B. Masters
Anthony B. Masters

Written by Anthony B. Masters

This blog looks at the use of statistics in Britain and beyond. It is written by RSS Statistical Ambassador and Chartered Statistician @anthonybmasters.

No responses yet