Skip to content

GitLab Pages Deployment

Automatische Deployment

GitLab Pages wordt automatisch geconfigureerd via .gitlab-ci.yml. Wanneer je naar de main of master branch pusht, wordt de documentatie automatisch gebouwd en gehost.

Hoe het werkt

  1. Push naar main/master branch
  2. GitLab CI/CD draait automatisch de pages job
  3. MkDocs build genereert de statische site in public/ folder
  4. GitLab Pages host de site automatisch

URL

Na de eerste succesvolle pipeline is je documentatie beschikbaar op:

https://<username>.gitlab.io/<project-name>/

Of als je een custom domain hebt:

https://<your-custom-domain>/

Handmatig Builden (lokaal)

Als je lokaal wilt testen hoe het eruit ziet:

# Build voor GitLab Pages (output naar public/)
npm run docs:build:gitlab

# Of direct
mkdocs build --site-dir public

Configuratie

De GitLab CI/CD configuratie staat in .gitlab-ci.yml:

pages:
  stage: pages
  image: python:3.11
  script:
    - pip install -r requirements-docs.txt
    - mkdocs build --site-dir public
  artifacts:
    paths:
      - public
  only:
    - main
    - master

Probleemoplossing

Pages job faalt

  1. Check of requirements-docs.txt bestaat
  2. Check of mkdocs.yml correct is
  3. Check de GitLab CI/CD logs voor foutmeldingen

Documentatie niet zichtbaar

  1. Ga naar Settings > Pages in je GitLab project
  2. Check of de pages job succesvol is afgerond
  3. Wacht een paar minuten (GitLab Pages kan even duren om te deployen)

Custom Domain

  1. Ga naar Settings > Pages
  2. Voeg je custom domain toe
  3. Configureer DNS records zoals aangegeven

Verschil met GitHub Pages

  • GitLab Pages: Automatisch via CI/CD pipeline (geen extra actie nodig)
  • GitHub Pages: Vereist mkdocs gh-deploy commando of GitHub Actions

Beide methoden werken, maar GitLab Pages is geïntegreerd in je bestaande CI/CD pipeline.