GitLab Pages¶
With GitLab Pages, static websites can be published directly from a repository in GitLab.
These websites are automatically deployed with GitLab CI/CD pipelines and support static website generators such as Sphinx Hugo, Jekyll or Gatsby. They can be connected to custom domains and SSL/TLS certificates.
First steps¶
First create a
.gitlab-ci.yml
file, for Sphinx for example with the following content:gitlab-ci.yml¶1image: python:latest 2 3stages: 4 - deploy 5 6pages: 7 stage: deploy 8 rules: 9 - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH 10 before_script: 11 - python -m pip install furo sphinxext-opengraph sphinx-copybutton sphinx_inline_tabs 12 script: 13 - cd docs && make html 14 after_script: 15 - mv docs/_build/html/ ./public/ 16 artifacts: 17 paths: 18 - public
- Line 6
GitLab recognises from the job name
pages
that you want to provide a GitLab Pages website.- Lines 15, 18
GitLab always makes your website available from a specific folder called
public
in your repository.
GitLab Pages provides default domain names based on your account or group name and project. Predictable URLs are generated from these. For the cusy GitLab instance, this is
pages.cusy.io
. If your project is accessible athttps://ce.cusy.io/GROUPNAME/PROJECTNAME
, then the associated GitLab Pages are accessible athttps://GROUPNAME.pages.cusy.io/PROJECTNAME
.See also
GitLab Pages also supports custom domains. You can find more information at GitLab Pages custom domains.