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!
In the meantime, you can find an introduction to the changes and new features in the v1.0 release blog post and this "Up & running with blogdown in 2021" blog post.
— Yihui, Amber, & Alison
3.4 GitLab Pages
GitLab (http://gitlab.com) is a very popular way to host the source code of your project. GitLab has a built in Continuous Integration & Deployment (CI/CD) service that can be used to host static websites, named GitLab Pages. The major advantage of using GitLab Pages is that you will be able to compile all your Rmd posts through its CI/CD service instead of your local computer and any generated content, such as HTML files, will be automatically copied to the web server. Please note that this approach has similar issues as the Travis + GitHub approach in Section 3.3.
GitLab’s CI/CD service uses the instructions stored in the YAML file
.gitlab-ci.yml in the repository. Here is a sample configuration file
.gitlab-ci.yml from the example repository https://gitlab.com/rgaiacs/blogdown-gitlab:
image: debian:buster-slim before_script: - apt-get update && apt-get -y install pandoc r-base - R -e "install.packages('blogdown',repos='http://cran.rstudio.com')" - R -e "blogdown::install_hugo()" pages: script: - R -e "blogdown::build_site()" artifacts: paths: - public only: - master
image option specifies what Docker image will be use as a start point. We are using a Debian image but any image from Docker Hub can be used. Other settings and options are similar to
.travis.yml in Section 3.3. The above example generates the website at https://rgaiacs.gitlab.io/blogdown-gitlab.