A note from the authors: Some of the information and instructions in this book are now out of date because of changes to Hugo and the blogdown package. If you have suggestions for improving this book, please file an issue in our GitHub repository. Thanks for your patience while we work to update the book, and please stay tuned for the revised version!
— Yihui, Amber, & Alison
There are a lot of ways to start building a website and deploy it. Because of the sheer number of technologies that you need to learn to fully understand how a website works, we’d like to recommend one workflow to beginners, so that hopefully they do not need to digest the rest of this book. This is definitely not the most optimal workflow, but requires you to know the fewest technical details.
To start a new website:
Carefully pick a theme at https://themes.gohugo.io, and find the link to its GitHub repository, which is of the form
Create a new project in RStudio, and type the code
blogdown::new_site(theme = 'user/repo')in the R console, where
user/repois from the link in Step 1.
Play with the new site for a while and if you do not like it, you can repeat the above steps, otherwise edit the options in
config.toml. If you do not understand certain options, go to the documentation of the theme, which is often the README page of the GitHub repository. Not all options have to be changed.
To edit a website:
Click the RStudio addin “Serve Site” to preview the site in RStudio Viewer. This only needs to be done once every time you open the RStudio project or restart your R session. Do not click the
Knitbutton on the RStudio toolbar.
Use the “New Post” addin to create a new post or page, then start writing the content.
Use the “Update Metadata” addin to modify the YAML metadata if necessary.
To publish a website, see Section 1.3.