Using GitLab Pages
On this page
git.nrw offers GitLab Pages to host static websites straight from your repositories, making it easy to publish documentation or personal project sites. You can also configure custom domains for your sites, allowing branded and externally accessible URLs like “my-website-12345.pages.git.nrw” or “testuser.git.nrw/my-website”.
Details
GitLab Pages provides a free, static website generated directly from a repository in git.nrw, showing predefined contents of your project.
To publish a website with Pages, use any static site generator like Gatsby, Jekyll, Hugo, Middleman, Harp, Hexo, or Brunch. Pages also supports websites written directly in plain HTML, CSS, and JavaScript. Dynamic server-side processing (like .php and .asp) is not supported.
You can find instructions on how to get started , as well as tutorials and additional information in the GitLab Docs.
To deploy your site, GitLab uses its built-in tool called GitLab CI/CD
to build your site and publish it to the GitLab Pages server. The sequence of scripts that GitLab CI/CD runs to accomplish this task is created from a file named .gitlab-ci.yml.
By default, GitLab deploys your website from a specific folder called public in your repository. You can also set a custom folder to be deployed with Pages
.
Example using simple HTML
To show a quick example using HTML, we will publish all website related contents (here all .html files) inside a specific directory when there is a push to our main branch.
- Create the
.gitlab-ci.ymlfile, a newpublicdirectory in yourmainbranch, anindex.htmlfile inside the new directory - Insert some simple formatting code into the
.htmlfile - Insert the following into the
.gitlab-ci.ymlfile:
pages:
stage: deploy
script:
- echo "Nothing to build"
artifacts:
paths:
- public
only:
- main
- Push to main
Now, whenever there is a push to your main branch, the contents of your public directory will be published. You can view the different Pages of your project following Deploy -> Pages on the left sidebar.
By default, a unique domain is created for every Pages website of your project and should look something like this:
https://<name of your project>-abcde1.pages.git.nrw/