Problem

A Hugo knowledge base needs more than a repository. It needs reviewable content changes, a static-site build, search indexing, custom-domain hosting, deployment rollback, and a way to recover if the primary platform fails.

GitHub and GitLab can both support that pipeline, but they optimize for slightly different operating models.

Short answer

Choose GitHub Pages when a simple public repository plus native Pages hosting is enough.

Choose private GitLab source plus Cloudflare Pages when you want private source control, merge-request automation, and hosting separated from the repository platform.

The important clarification is that GitLab is not the production web host in this setup. GitLab is the source and review control plane; Cloudflare Pages builds and serves the public site.

The narrative version of this comparison is in How to choose GitHub or GitLab for a Hugo knowledge base.

Practical comparison

ConcernGitHub Pages modelGitLab + Cloudflare Pages model
Repository visibilityOften simplest when the source can be publicPrivate source fits naturally
Review workflowPull requestsMerge requests; push options can create MRs directly
Static hostingNative GitHub PagesCloudflare Pages connected to GitLab
Build pipelineGitHub Actions is tightly integrated and simpleCloudflare runs the Hugo/Pagefind build directly
RollbackConvenient if the old Pages deployment remains untouchedHosting can remain independent of source-platform history
OIDC/cloud automationGitHub Actions OIDC is mature and easy to federateGitLab OIDC is also possible, but must be designed separately
Operational shapeFewer moving partsMore moving parts, stronger separation of concerns
Best fitPublic documentation, simple personal sitesPrivate source, controlled deployment, platform independence

What the real migration showed

The original Hugo KB used GitHub as both source and Pages host. That model was easy to understand:

Markdown → GitHub repository → GitHub Actions → GitHub Pages

The migrated model separates source control from hosting:

Markdown → private GitLab merge request → protected main → Cloudflare Pages → public KB

This separation had three useful effects:

  1. The source could remain private while the generated site stayed public.
  2. Cloudflare Pages owned deployment, including custom-domain activation and deployment rollback.
  3. The old GitHub Pages deployment remained unchanged as a read-only rollback target during cutover.

The migration did not prove that GitLab is universally better than GitHub. It showed that separating source, review, build, and hosting makes recovery and platform replacement easier.

Decision guide

Use GitHub Pages when:

  • the repository can be public
  • you want the fewest moving parts
  • GitHub Actions and Pages are sufficient
  • rollback means staying within the GitHub ecosystem

Use GitLab plus Cloudflare Pages when:

  • the Markdown source should remain private
  • you want merge-request-driven publishing
  • hosting should not depend on the repository provider
  • you want Cloudflare DNS, certificates, caching, and Pages deployment in one edge platform
  • you are comfortable operating two platforms instead of one

Do not choose either platform only because of search indexing. Hugo output and Pagefind indexing are portable; the repository provider does not meaningfully change the generated search index.

Gotchas

  • A private source repository does not make public content safe by itself. Scan generated pages for tokens, internal hostnames, organization-specific details, and drafts.
  • Hugo can leave stale pages in a reused public/ output directory. Validate production from a clean build destination.
  • Cloudflare Pages preview behavior differs from GitHub Pages. Decide explicitly whether preview branches should be public, protected, or disabled.
  • Existing OIDC or workload-identity trust may still point at the old repository platform. Treat it as legacy infrastructure until it is migrated or retired.
  • Keeping the old platform as rollback is useful during migration, but permanent dual operation creates confusion. Record which system is canonical.

References