<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Gitlab Pages是什么？]]></title><description><![CDATA[<p dir="auto">下面把 <strong>GitLab Pages</strong> 按“你从未用过、但要在自建 GitLab 上把它做成团队文档统一入口”的角度，系统讲清楚：它是什么、怎么工作、你需要准备什么、怎么和 MkDocs/集中站点/NodeBB/企业微信配合。</p>
<hr />
<h1>1. GitLab Pages 是什么</h1>
<p dir="auto"><strong>GitLab Pages = GitLab 自带的静态网站托管能力。</strong><br />
你把网站的静态文件（HTML/CSS/JS/图片等）通过 CI 产出成一个 artifact，GitLab Pages 就会把它对外提供成一个网站。(<a href="https://docs.gitlab.com/user/project/pages/?utm_source=chatgpt.com" title="GitLab Pages" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</p>
<p dir="auto">关键点：<strong>它只托管“静态网站”</strong>，不跑后端（不跑 .NET 服务、不跑数据库）。适合文档站、前端构建产物、产品手册、项目主页等。</p>
<hr />
<h1>2. GitLab Pages 怎么工作的（核心机制）</h1>
<p dir="auto">Pages 的发布有一个非常清晰的约定：</p>
<ul>
<li>CI 中有一个 <strong>Pages job</strong>（job 名可以叫 <code>pages</code>，也可以自定义）。</li>
<li>这个 job 必须产出一个目录（传统默认叫 <code>public</code>）作为 artifacts。</li>
<li>GitLab 会把这个 artifacts 部署成网站。(<a href="https://docs.gitlab.com/user/project/pages/public_folder/?utm_source=chatgpt.com" title="GitLab Pages public folder" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</li>
</ul>
<p dir="auto">早期常见约定是目录名必须叫 <code>public</code>。(<a href="https://docs.gitlab.com/user/project/pages/public_folder/?utm_source=chatgpt.com" title="GitLab Pages public folder" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)<br />
较新的方式是：你可以在 <code>.gitlab-ci.yml</code> 里用 <code>pages: publish:</code> 指定发布目录，比如 <code>dist</code>。(<a href="https://docs.gitlab.com/user/project/pages/introduction/?utm_source=chatgpt.com" title="GitLab Pages settings" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</p>
<hr />
<h1>3. 你最终会得到的 URL 长什么样</h1>
<p dir="auto">GitLab Pages 的域名/路径规则跟 GitLab 的用户/组/项目结构相关，常见会区分：</p>
<ul>
<li><strong>Project Pages</strong>（项目级网站）</li>
<li><strong>Group Pages / User Pages</strong>（组/用户级网站）</li>
<li>支持自定义域名(<a href="https://docs.gitlab.com/user/project/pages/getting_started_part_one/?utm_source=chatgpt.com" title="GitLab Pages default domain names and URLs" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</li>
</ul>
<p dir="auto">你是自建 GitLab，所以最关键不是“规则长啥样”，而是你们管理员在 GitLab 上给 Pages 配了什么域名（通常需要一个单独的 Pages 域名，比如 <code>pages.xxx.com</code> 或 <code>pages.xxx.net</code>，并做 DNS/证书配置）。</p>
<hr />
<h1>4. 自建 GitLab 上，Pages 要能用，管理员侧需要什么</h1>
<p dir="auto">这部分通常由运维/管理员做一次，之后所有项目都能用 Pages。</p>
<p dir="auto">典型前置条件包括：</p>
<ul>
<li>为 Pages 准备一个独立域名（例如 <code>pages.example.com</code> 或 <code>example.io</code>）</li>
<li>为该域名配置 <strong>通配符 DNS</strong>（例如 <code>*.pages.example.com</code>）(<a href="https://docs.gitlab.com/administration/pages/source/?utm_source=chatgpt.com" title="GitLab Pages administration for self-compiled installations" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</li>
<li>（可选但强烈建议）配置 <strong>通配符 TLS 证书</strong>，以便 <code>*.pages...</code> 全部走 HTTPS(<a href="https://docs.gitlab.com/administration/pages/source/?utm_source=chatgpt.com" title="GitLab Pages administration for self-compiled installations" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</li>
<li>自建安装还需要 <code>zip/unzip</code> 等用于处理 artifacts 的依赖（具体取决于部署方式）(<a href="https://docs.gitlab.com/administration/pages/source/?utm_source=chatgpt.com" title="GitLab Pages administration for self-compiled installations" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</li>
</ul>
<p dir="auto">如果你在 GitLab UI 里看不到 Pages 相关开关/设置，一般就是管理员还没启用或没配置。(<a href="https://docs.gitlab.com/user/project/pages/pages_access_control/?utm_source=chatgpt.com" title="GitLab Pages access control" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</p>
<hr />
<h1>5. 最小可用的 Pages 示例（用 MkDocs 举例）</h1>
<p dir="auto">你不需要理解太多，掌握一条：<strong>CI 构建 → 产出静态目录 → Pages 发布</strong></p>
<p dir="auto">以 MkDocs 为例：</p>
<pre><code class="language-yaml">stages: [build, deploy]

build-docs:
  stage: build
  image: python:3.12-alpine
  script:
    - pip install mkdocs-material
    - mkdocs build -d public
  artifacts:
    paths:
      - public
    expire_in: 7 days

pages:
  stage: deploy
  script:
    - echo "deploy pages"
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
</code></pre>
<p dir="auto">说明：</p>
<ul>
<li><code>mkdocs build -d public</code>：把站点生成到 <code>public/</code></li>
<li><code>pages</code> job 把 <code>public/</code> 作为 artifact 给 GitLab Pages 用(<a href="https://docs.gitlab.com/user/project/pages/public_folder/?utm_source=chatgpt.com" title="GitLab Pages public folder" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</li>
</ul>
<blockquote>
<p dir="auto">你会发现：Pages 的本质就是“把某个目录托管成网站”。</p>
</blockquote>
<hr />
<h1>6. Pages 的权限与访问控制（你这种“内部知识库”很关键）</h1>
<p dir="auto">GitLab Pages 支持<strong>访问控制</strong>：可以根据项目可见性/设置决定谁能访问 Pages。(<a href="https://docs.gitlab.com/user/project/pages/pages_access_control/?utm_source=chatgpt.com" title="GitLab Pages access control" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</p>
<p dir="auto">对你们团队知识库，我通常建议两种策略：</p>
<ol>
<li><strong>内部可见（需要 GitLab 登录）</strong>：安全、适合内网知识</li>
<li><strong>公开可见</strong>：适合对外文档（比如开源项目）</li>
</ol>
<p dir="auto">你想做“集中网站给团队看”，大概率选第 1 种。</p>
<hr />
<h1>7. 回到你的痛点：为什么 GitLab Pages 适合“集中式文档站”</h1>
<p dir="auto">你担心的不是“能不能发布”，而是：</p>
<ul>
<li>500 仓库文档散落，没人看</li>
<li>需要一个<strong>统一入口 + 统一导航 + 统一搜索</strong></li>
<li>还要能通知到 NodeBB/企业微信</li>
</ul>
<p dir="auto">Pages 在这里的价值是：</p>
<ul>
<li>发布非常标准化：CI 产出静态目录即可(<a href="https://docs.gitlab.com/user/project/pages/public_folder/?utm_source=chatgpt.com" title="GitLab Pages public folder" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</li>
<li>权限可继承 GitLab 的组织结构（内部站点很方便）(<a href="https://docs.gitlab.com/user/project/pages/pages_access_control/?utm_source=chatgpt.com" title="GitLab Pages access control" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</li>
<li>你可以把<strong>中央聚合仓库</strong>的 Pages 当作唯一入口（docs portal）</li>
</ul>
<hr />
<h1>8. 你问“为什么不直接 NodeBB 发帖就算了”：Pages + NodeBB 的正确分工</h1>
<p dir="auto">结论：<strong>NodeBB 负责“通知与讨论”，Pages 负责“可长期引用的最终文档”。</strong></p>
<ul>
<li>Pages 站点：目录、搜索、稳定 URL、版本演进</li>
<li>NodeBB：把“本次变更摘要 + 链接”推送给所有人，并在贴内讨论</li>
</ul>
<p dir="auto">这两者叠加，你会得到：</p>
<ul>
<li>“大家会看到”（通知推送）</li>
<li>“大家能查到”（文档站可检索）</li>
<li>“半年后仍然可追溯”（Git + Pages 稳定链接）</li>
</ul>
<hr />
<h1>9. 你下一步应该怎么验证 Pages 是否已就绪（不需要猜）</h1>
<p dir="auto">在你们自建 GitLab 上，最快的验证方式是：</p>
<ol>
<li>新建一个测试项目 <code>pages-test</code></li>
<li>放一个最简单的 <code>.gitlab-ci.yml</code>：创建 <code>public/index.html</code> 并发布</li>
<li>跑 pipeline，看项目的 Pages 设置里是否出现可访问 URL（或提示管理员启用）</li>
</ol>
<p dir="auto">官方也提供“从零创建 Pages”的指导思路（本质就是 CI 产出静态目录）。(<a href="https://docs.gitlab.com/user/project/pages/getting_started/pages_from_scratch/?utm_source=chatgpt.com" title="Tutorial: Create a GitLab Pages website from scratch" target="_blank" rel="noopener noreferrer nofollow ugc">GitLab 文档</a>)</p>
<hr />
<h2>我建议你做的最短落地路径（针对你“集中站点 + 通知”）</h2>
<ol>
<li>先把 Pages 跑通：<code>pages-test</code> 项目发布一个静态页</li>
<li>建立 <code>docs-portal</code>（中央仓库）用 MkDocs 发布 Pages</li>
<li>让 <code>docs-portal</code> 作为唯一入口（先不急着聚合 500 项目）</li>
<li><code>docs-portal</code> 发布后：CI 同步推送到企业微信 + NodeBB（每日汇总更合理）</li>
</ol>
<hr />
<p dir="auto">如果你愿意，我下一条可以直接给你一套“验证 Pages 就绪”的最小项目内容（<code>index.html</code> + <code>.gitlab-ci.yml</code>），以及一个 <code>docs-portal</code> 的 MkDocs 初始仓库骨架（导航、首页、日报/ADR 模板、发布后通知脚本接口），你复制进去就能跑。你只需要告诉我你们 GitLab 的 Pages 域名大概是怎样配置的（比如 <code>*.pages.xxx.com</code> 还是 <code>pages.xxx.com/&lt;group&gt;/&lt;project&gt;</code>），我就能把链接规则也写进模板里。</p>
]]></description><link>https://talk.loda.net/topic/40/gitlab-pages是什么</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Apr 2026 08:55:41 GMT</lastBuildDate><atom:link href="https://talk.loda.net/topic/40.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 05 Jan 2026 19:19:37 GMT</pubDate><ttl>60</ttl></channel></rss>