There was a time when publishing a website meant opening an FTP client, dragging a folder into public_html, and watching a progress bar inch across the screen. This process had its charm in its simplicity. You could see every file, understand where it lived, and put a change online without a platform, a plugin ecosystem or a plethora of dependencies having an opinion about it.

That simplicity came with trade-offs. FTP offered no built-in version history, review process, repeatable deployment or reliable record of exactly what changed in production. Now, don't get me wrong. I've not used FTP to manage a website in probably over 15 years. But managing some web systems has become something PhD-worthy and I pine for the days of that simplicity. For this site, I use Eleventy with GitLab Pages. It keeps the appealing part of the old model—build a folder of plain files, then publish it. All while adding build tooling, version control and automated deployment. A single git push can take the site from source files to a published update.

I'm not going to cover setting up Eleventy in this post. The options are far too varied plus there's loads of great documentation on setting it out there already.

What GitLab Pages needs

GitLab Pages only needs a CI job that produces the directory to publish. My Gitlab pipeline uses a current Node image, installs dependencies from the lockfile and runs the production build:

image: node:24-bookworm-slim

stages:
  - deploy

deploy-pages:
  stage: deploy
  script:
    - npm ci
    - npm run build
  pages:
    publish: _site
  rules:
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'

pages.publish is the important part: it tells GitLab which build output to host. The branch rule means the public site is updated from the default branch, while feature branches stay safely separate. It's like having a dependable robot doing the FTPing for you.

Start with a production build

The command GitLab runs should be the same one that works locally:

npm ci
npm run build

npm ci makes CI reproducible by installing exactly the versions recorded in package-lock.json. Eleventy then writes the finished site into _site (or whatever directory your Eleventy site is set to build into).

Before pushing a pipeline change, run the build locally and inspect the generated output. This catches missing environment variables, bad front matter and remote image failures before CI explains them in a small, judgemental red box.

Cache npm's download directory

CI runners are ephemeral: they wake up, do their job and disappear. Dependencies would normally be downloaded on every run, so caching npm's download directory keeps builds faster while still allowing npm ci to create a clean node_modules directory each time:

variables:
  npm_config_cache: '$CI_PROJECT_DIR/.npm'

cache:
  key:
    files:
      - package-lock.json
  paths:
    - .npm/

Using package-lock.json in the cache key means a dependency update naturally starts a fresh cache.

Configure Pages in GitLab

After the first successful pipeline, do the following:

  1. Open Deploy > Pages in the GitLab project.
  2. Confirm the generated Pages URL.
  3. Add a custom domain if required, then follow GitLab's DNS verification instructions.
  4. Keep the Pages job limited to the default branch unless preview deployments are intentional.

Keep deployment concerns separate

The site build should remain responsible for generating _site (or whatever directory your Eleventy site is set to build into); the GitLab pipeline should remain responsible for publishing it. Keeping that boundary clear makes it easy to test the build locally and move the same output to another host later.

For a small Eleventy site, that is all the deployment machinery required: commit, build, publish. GitLab Pages keeps the directness that made FTP appealing, but adds the version control and repeatable build process that a modern site needs.