Hugo allow us to quickly create a blog (or any static website) and start creating content by writing markdown files. In order to deploy the website there are many solutions, such as Netlify, Google Firebase or Amazon S3… For my developer blog, I chose Gitlab Pages as it integrates easily with my project on Gitlab.

Gitlab configuration

Create a .gitlab-ci.yml file at the root of your project, and add the following code to automatically deploy your Hugo website at every merge to the master branch.

# All available Hugo versions are listed here:

  - build


  stage: build
    - hugo
      - public
    - master

If your project is private (or internal), you may have to open the visibility for Gitlab pages :

In Settings > General > Visibility, project features, permissions, the Pages feature should be enabled and set to everyone

Gitlab Pages

  1. Click on new pages domain
  2. Set the domain field to your domain name, for instance “
  3. If your do not already have a certificate, leave Automatic certificate management using Let’s Encrypt checked
  4. Click on Create new domain

Gitlab Pages configuration

DNS configuration

Create DNS record

As indicated in the Gitlab pages configuration page, we have to create a new DNS record to redirect our domain name to

The following steps will only work for a subdomain (for instance If you want to configure for a root domain, please see the documentation in the links at the bottom of this article.

  1. In your OVH dashboard, select the DNS zones tab, and click on Add an entry
  2. Select CNAME
  3. Set the same subdomain as defined in the Gitlab pages configurations (here www)
  4. Set the target as indicated by the Gitlab page Do not forget the period at the end.
  5. Click on next and validate

Verify ownership

  1. Select TXT field type
  2. In subdomain, enter _gitlab-pages-verification-code.www
  3. Set value to gitlab-pages-verification-code=xxxxxxxxxxxxxxxxxxxxxxxxx
  4. In your Gitlab page configuration,
  5. Wait (a few minutes later, or hours)
  6. Click on the arrow next to “Unverified” (retry verification), the status should switch to “verified”

OVH DNS configuration