Skip to content

Documentation Sites ​

A Context documentation site is a static website built from the same approved knowledge as your knowledge package. Once it is turned on, every build writes the package and a sibling website folder. You preview the website locally and upload it to any static host.

mermaid
flowchart LR
  map["Knowledge map"] --> build["Build"]
  approved["Approved knowledge"] --> build
  ext["Site customizations<br/>(optional)"] --> build
  build --> site["Website folder"]
  site --> preview["Local preview"]
  site --> host["Your static host"]

What to ask for ​

You ask forThe Agent does
Package and websiteBuilds both from one package declaration
Package onlyTurns the website off and rebuilds; the old website folder is deleted
Add a website laterTurns the website on, places any pages that are not yet in navigation, and rebuilds
Website only for sharingBuilds the package too, and shares only the website folder

A typical request:

Add a documentation site titled "Project knowledge" in English, hosted under /docs/, with a link to our repository on the homepage.

The Agent sets the site title, language, address prefix and homepage for you. The address prefix only changes the site's URLs, not its output folder. The website folder is named after the package, minus one trailing -kb: project-kb builds dist/project-kb/ and dist/project-site/. Every option the Agent can set is listed under Site options in Project API.

What the site offers ​

  • Homepage — every top-level section of the knowledge map as a card with a short preview of its pages, plus resource cards.
  • Navigation — sections in the top bar; the left sidebar shows only the current section's pages. Each section's landing page shows its groups as cards.
  • Search — local search, opened with the search button or Cmd/Ctrl+K; no search service needed.
  • Theme — light and dark. The site opens in light mode until the reader switches, and remembers that choice; see Customizing Pages and Themes.
  • Missing pages — an unknown address shows a 404 page in the reader's language with a link back home.
  • Diagrams — Mermaid rendered in the browser with fit, 100%, zoom, full-screen and source controls. An invalid diagram shows its source with a notice instead of blocking publication.
  • Provenance — each page ends with its sources: repository entries link to the recorded revision, document entries to their registered URL. Inline code that names a cited repository file or directory links to that path at the recorded revision.
  • Source map — on by default, each page ends with a map instead of a plain list: the page's sections in the middle, the documents they cite around them, grouped by where each one comes from. Hovering highlights what a section or document links to, clicking a document opens the cited lines, and a List view shows the same documents with their line ranges; narrow screens show only the list. Below it, other pages citing the same documents are linked. The map is computed during the build from the recorded references, so no extra step is needed; site.sourceMap: false returns the plain list.
  • LLM Docs and Changelog — the site can link the plain-text LLM Docs produced by the same build, and the knowledge base's changelog.

Code samples and raw HTML are displayed as content, never executed.

The knowledge map decides the sidebar. Each entry points to a page by its identity, so renaming a label or moving a page to another group never changes its URL, and one page can appear in several places while keeping one URL. Every selected page needs a place in the map before the build; if some are missing, the Agent places them or asks you where they belong. Groups can stay empty while their pages are still planned.

The sidebar keeps the order you give the map at every level. Articles and directories can sit side by side in that order: a section can open with an overview and a quick start, followed by a Guides directory and a Reference directory. Each section's landing page follows the same order, showing every directory as a card and gathering consecutive articles that sit outside a directory into one shared card at their place in the sequence. To change the order, ask the Agent to reorder the entries; see Reorganizing at Scale. Context versions before 0.7.82 always listed directories ahead of their sibling articles, whatever order the map gave.

You can also ask the Agent for extra links in the top bar (for example a link back to a documentation home), items in the More menu (for example release notes kept outside the map), icon links, or a different target for the site title. Links that start with / point to the same domain, so a site under /docs/ can link to a sibling application. The exact settings are in Project API.

Some content belongs in a knowledge package but not in the site's menus, such as detailed material that only Agents need. Ask the Agent to place it under a hidden group in the knowledge map. A hidden group and everything under it stay out of the sidebar, the top navigation and the "All articles" list, yet its pages still count as placed, keep their URLs when the site selects them and stay in package navigation and LLMS. Link to them from an entry article on the site. To leave those pages off the website entirely, the Agent also excludes them from the website package; see Knowledge Packages.

Homepage resource cards ​

Resource cards point readers to places beyond the site, such as the repository that maintains this knowledge. A card opens a link, offers a command to copy, or both, and a featured card also appears among the actions at the top of the homepage.

The values come from real sources, never from guesses: settings you have confirmed, the workspace's repository remotes, or real deployment results. Unknown destinations are left out, with no invented links and no empty placeholder cards. Changing the cards means a rebuild; the hosted site changes the next time you deploy.

Previewing ​

Ask the Agent to preview the site:

Build the site and open a local preview.

The Agent serves the website folder through a local HTTP server. The website is generated in a staging folder first, so a failed build keeps the previous package and site. The Agent's completion report lists the package, the website and LLM text separately — each as generated, failed or not selected — with navigation coverage and the preview URL it checked.

A build does not re-read your source repositories, so you can build and deploy without them checked out. Before deploying, the Agent still checks whether cited sources have changed, moved or gone missing, and tells you if any pages need an update.

Deploying ​

Deploy the contents of the website folder with your chosen static hosting tool. Context's build includes no hosting service, login or deployment step. After every successful website build the Agent tells you which folder to deploy and, if you have authorized a target, uses a compatible deployment Skill. Only the website folder is published — never sources, private workspace state or the whole package — and success is reported only after the hosted URL is checked.

Once the site is live, ask the Agent to record its public address in the package, so query Skills can link answers to site pages. The address is an access hint, not proof of publication, and rebuilds keep it.

To change pages, slots and colors, see Customizing Pages and Themes; for other languages, Multilingual Sites.

文档站 ​

Context 文档站是一个静态网站,与你的知识包基于同一批已批准的知识构建。开启后,每次构建都会写出知识包和一个同级的网站文件夹。你可以在本地预览网站,也可以把它上传到任意静态托管服务。

mermaid
flowchart LR
  map["知识地图"] --> build["构建"]
  approved["已批准的知识"] --> build
  ext["站点定制<br/>(可选)"] --> build
  build --> site["网站文件夹"]
  site --> preview["本地预览"]
  site --> host["你的静态托管"]

提出什么要求 ​

你的要求Agent 的做法
知识包和网站由同一个知识包声明同时构建两者
只要知识包关闭网站并重新构建;旧的网站文件夹会被删除
之后再添加网站开启网站,把尚未进入导航的页面放置好,然后重新构建
只为分享而要网站同样构建知识包,但只分享网站文件夹

一个典型的请求:

添加一个标题为“Project knowledge”的英文文档站,托管在 /docs/ 下,并在首页放一个指向我们仓库的链接。

Agent 会为你设置站点标题、语言、地址前缀和首页。地址前缀只改变站点的 URL,不改变输出文件夹。网站文件夹以知识包名称命名,并去掉末尾的一个 -kb:project-kb 会构建出 dist/project-kb/ 和 dist/project-site/。Agent 可以设置的所有选项都列在 Project API 的站点选项中。

站点提供什么 ​

  • 首页——知识地图的每个一级分区显示为一张卡片,附有其页面的简短预览,另有资源卡片。
  • 导航——顶栏显示各分区;左侧边栏只显示当前分区的页面。每个分区的落地页把其分组显示为卡片。
  • 搜索——本地搜索,可通过搜索按钮或 Cmd/Ctrl+K 打开;不依赖搜索服务。
  • 主题——浅色和深色。站点默认以浅色模式打开,直到读者切换,并会记住这一选择;参见 页面与主题定制。
  • 缺失页面——访问不存在的地址时显示 404 页面,使用读者的语言,并提供返回首页的链接。
  • 图表——Mermaid 在浏览器中渲染,提供适应、100%、缩放、全屏和查看源码等控件。无效的图表会显示源码和提示,而不会阻止发布。
  • 来源——每个页面末尾列出其来源:仓库条目链接到记录的修订版本,文档条目链接到其登记的 URL。行内代码如果指向被引用仓库中的文件或目录,会链接到记录版本中的对应路径。
  • 来源地图 — 默认开启,每页结尾不再是一串清单,而是一张图:页面的各个小节居中,它们引用的文档环绕在外,按来源分组。悬停会高亮某个小节或文档关联到的内容,点击文档打开被引用的行,列表视图则按分组列出同样的文档及其行号区间;窄屏只显示列表。图下方链接到引用了相同文档的其他页面。这张图在构建时按已记录的引用生成,不需要额外步骤;设 site.sourceMap: false 可退回纯列表。
  • LLM Docs 与 Changelog——站点可以链接同一次构建产出的纯文本 LLM Docs,以及知识库的 Changelog。

代码示例和原始 HTML 只作为内容展示,绝不会被执行。

导航来自知识地图 ​

知识地图决定侧边栏。每个条目通过身份标识指向页面,因此重命名标签或把页面移到其他分组都不会改变它的 URL,同一个页面也可以出现在多个位置而只保留一个 URL。构建前,每个选中的页面都需要在知识地图中有位置;如果有缺失,Agent 会把它们放好,或询问你应放在哪里。在页面仍处于计划阶段时,分组可以暂时为空。

侧边栏在每一层都保持你在知识地图中给出的顺序。文章和目录可以按这个顺序并列:一个分区可以先放概览和快速上手,再放「指南」目录和「参考」目录。每个分区的落地页也遵循同样的顺序:每个目录显示为一张卡片,不在目录中的连续文章合并为一张卡片,出现在它们在顺序中的位置。要调整顺序,请让 Agent 重新排列条目;参见 大规模重组。0.7.82 之前的 Context 版本无论知识地图如何排序,总是把目录排在同级文章之前。

你也可以请 Agent 在顶栏添加额外链接(例如返回文档首页的链接)、在“更多”菜单中添加条目(例如保留在知识地图之外的发布说明)、添加图标链接,或更改站点标题的跳转目标。以 / 开头的链接指向同一域名,因此位于 /docs/ 下的站点可以链接到同级应用。具体设置见 Project API。

有些内容属于知识包,但不应出现在站点菜单里,例如只有 Agent 才需要的详细材料。请 Agent 把它放到知识地图中的隐藏分组下。隐藏分组及其下的所有内容不会出现在侧边栏、顶部导航和“全部文章”列表中,但其页面仍算作已放置,在站点选中时保留各自的 URL,并保留在知识包导航和 LLMS 中。请从站点上的一篇入口文章链接到它们。若要让这些页面完全不出现在网站上,Agent 还会把它们从网站包中排除;参见知识包。

首页资源卡片 ​

资源卡片把读者引向站点之外的地方,例如维护这些知识的仓库。卡片可以打开一个链接、提供一条可复制的命令,或两者兼有;精选卡片还会出现在首页顶部的操作按钮中。

这些值来自真实的来源,绝不靠猜测:你已确认的设置、知识工作区的仓库远端地址,或真实的部署结果。未知的目标会被省略,不会编造链接,也不会出现空的占位卡片。修改卡片需要重新构建;托管的站点会在你下一次部署时更新。

预览 ​

请 Agent 预览站点:

构建站点并打开本地预览。

Agent 会通过本地 HTTP 服务器提供网站文件夹。网站会先在暂存文件夹中生成,因此构建失败时会保留之前的知识包和站点。Agent 的完成报告会分别列出知识包、网站和 LLM 文本——每一项标为已生成、失败或未选择——同时给出导航覆盖情况和它检查过的预览 URL。

构建不会重新读取你的来源仓库,因此无需检出它们也能构建和部署。部署前,Agent 仍会检查被引用的来源是否有变化、移动或缺失,并告诉你是否有页面需要更新。

部署 ​

用你选择的静态托管工具部署网站文件夹中的内容。Context 的构建不包含任何托管服务、登录或部署步骤。每次网站构建成功后,Agent 会告诉你应部署哪个文件夹,如果你已授权某个目标,它还会使用兼容的部署 Skill。只发布网站文件夹——绝不发布来源、私有的工作区状态或整个知识包——并且只有在检查过托管后的 URL 之后才会报告成功。

站点上线后,请 Agent 把它的公开地址记录到知识包中,以便查询 Skill 能把回答链接到站点页面。这个地址只是访问提示,并不能证明已经发布;重新构建时会保留它。

如需修改页面、插槽和颜色,请参阅 页面与主题定制;如需支持其他语言,请参阅 多语言站点。