1 min read

Blogdown, Github Pages and Netlify

Finally it is working. Having tried two ways to host a blogdown/bookdown website: Github Pages and Netlify

Github Pages

Published Directory

I chose to use the docs directory as published directory, so that github pages can be generated by change the settings from github website. Add the line below to config.toml. ≈

publishDir = "docs"

I chose to use the docs directory as published directory.


R markdown extension needs to be “Rmd” so that Latex can be correctly rendered. They seem to be case-sensitive.


There is a nice tutorial available. Key mistakes I made along the way:

Hugo Version

In Rstudio, check the hugo version with command


Then in Netlify add the “HUGO_VERSION” variable to match.

Published Directory

Netlify setting should match the hugo setting. The default of hugo is public and it is customized in config.toml or config.yaml.

No need to put the directory under Github, and then ignore it in .gitignore.