Gitlab pages

How to deploy in GitLab pages?

  1. Set up CI/CD adding a file .gitlab-ci.yml with Hugo template. Change the master branch to main in the template.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# This file is a template, and might need editing before it works on your project.
---
# All available Hugo versions are listed here:
# https://gitlab.com/pages/hugo/container_registry
image: registry.gitlab.com/pages/hugo:latest

variables:
  GIT_SUBMODULE_STRATEGY: recursive

test:
  script:
    - hugo
  except:
    - main

pages:
  script:
    - hugo
  artifacts:
    paths:
      - public
  only:
    - main
  1. Modify the baseurl parameter with this structure baseURL = "https://<gitlab-user>.gitlab.io/<project-name>/".

  2. Enable the Pages Access Control for everyone visibility. Navigate to your project’s Settings > General and expand Visibility, project features, permissions > Pages > Everyone.