@antora/atlas-extension

中文文档
1.0.0-alpha.6发布于 2026/10/01MPL-2.0CommonJS近 30 天下载 1.2万

An Antora extension that manages references across discrete runs of Antora through the use of a site manifest.

原始使用文档
文档目录10 节
  1. Overview
  2. Prerequisites
  3. Install
  4. Register
  5. Configure Export
  6. Configure Import
  7. Enable
  8. Merge
  9. Import Mode
  10. Copyright and License

Antora Atlas Extension

The Antora Atlas Extension (herein, Atlas) manages references across discrete runs of Antora through the use of a site manifest.

⚠️ WARNING
This extension is currently ALPHA software! That means this extension experimental and likely to change without notice. You’re welcome to test it and give feedback, but take caution when relying on it in a production site.

📌 NOTE
If you’re looking for the precursor release line, which is a stable release line for users of this extension’s predecessor, refer to the v0.0.x branch.

Overview

The purpose of the extension is to support site composition (i.e., sharding) and partial builds.

When this extension is enabled, it will create and publish a site manifest to the root of the site. The site manifest is a JSON file named site-manifest.json. This file contains reference information for all pages and aliases in the site, grouped by component then version. This information is intended to be used to resolve references to these pages from a discrete site (e.g., an archive site) or partial build (only select components and/or versions).

When this extension is enabled and either the primary site manifest URL or primary site URL is specified, it will read the site manifest and import all the component versions and pages into the content catalog of the current site. The location of the site manifest can be a local path. If the location of the site manifest is a URL, the extension will download and cache it.

The virtual files the extension creates are merely stubs, enough to allow Antora to resolve references to them through their resource ID. The target URL of these files are external, pointing to the location in the published site rather than relative to the current site. Internally, Antora is able to distinguish between provided and imported resources by the presence of the site property.

Prerequisites

In order to use this extension, you must be using at least Node.js 20 and Antora 3.2.0 or newer. The following instructions assume you’ve already set up an Antora playbook file (i.e., antora-playbook.yml) to build your site.

To learn about using extensions with Antora, see the Antora extension documentation.

Install

Use the following command to install the extension into your Antora playbook project:

$ npm i @antora/atlas-extension

Register

Open your Antora playbook file and register the extension as an entry in the antora.extensions key. If this key doesn’t yet exist in your playbook, first create it.

antora-playbook.yml

antora:
  extensions:
  - '@antora/atlas-extension'

Configure Export

There’s no configuration necessary to export the site manifest. This behavior works automatically when the extension is enabled.

You can change the name or path of the site manifest file using the site-manifest-path attribute (though not recommended when just starting out). This value is assumed to be a relative path from the root of the site Antora is publishing.

asciidoc:
  attributes:
    site-manifest-path: _site-manifest.json

If the site.url key is set in the playbook, its value is included in the site manifest.

📌 NOTE
When the site manifest is imported in sharded mode, the site manifest export is only really intended for informational and reporting purposes. It’s not a complete site manifest and thus likely not useful for import.

Configure Import

Enable

In order to import a site manifest, you must specify the primary-site-manifest-url attribute (or, more succinctly, the primary-site-url attribute) in the Antora playbook.

asciidoc:
  attributes:
    primary-site-manifest-url: https://docs.example.org/site-manifest.json

If the site was published with this extension enabled using the default configuration, you only need to specify the URL of the primary site. The extension will automatically discover the site manifest.

asciidoc:
  attributes:
    primary-site-url: https://docs.example.org

In this case, the extension will look for the site manifest at https://docs.example.org/site-manifest.json, download it, and cache it. Atlas will only attempt to redownload it if the --fetch option is specified (or runtime.fetch=true in the playbook).

Alternately, you can specify an arbitrary path or URL of the site manifest to import. If the value is a URL, the extension will download it. Otherwise, it will read it from the location specified.

asciidoc:
  attributes:
    primary-site-manifest-url: ./primary-site-manifest.json

If the site manifest file cannot be found, the extension silently ignores the request to import it. If the manifest URL ends with .gz, Atlas will gunzip the file.

📌 NOTE
When the extension exports the manifest, it will not contain any resources that were previously imported in sharded mode.

Merge

Normally, Atlas only imports files from a component version that are not known (meaning not created from one of the content sources). The idea is that Atlas is filling in the missing parts of the site from the manifest.

If you’re using a local content source that only provides some of the files for a component version, you’ll need to request Atlas to merge any files from the site manifest that are not known. You can enable this behavior by setting the merge subkey of the import key in the extension configuration. (This is typically used for something like a lightweight home component).

antora:
  extensions:
  - require: '@antora/atlas-extension'
    import:
      merge: true

In this mode, Atlas will not replace any files in the same component version that is provided by the build. It will only append files. It will also ignore any aliases that target a provided page as the assumption is that the provided page defines the aliases.

Atlas tries to avoid creating any file conflicts when importing the missing files. However, you must understand that this functionality creates a unique situation whereby Atlas assumes that any imported files will still be provided by the next full build. Atlas cannot detect files which are set to be deleted in this case.

Import Mode

When importing files, Atlas operates in one of two modes: sharded or same site. The sharded mode is intended for a preview build, whereas same site mode is intended for a partial build (with some help from a build script).

Same site mode is activated if the primary-site-url (otherwise the url from the site manifest) matches the site URL. Otherwise, sharded mode is used.

Sharded

In sharded mode, Atlas imports files for the purpose of resolving references when only a portion of the site is built (i.e., a subset of the content sources). If a resource (such as a page) is not provided by the build, and is found in the site manifest, the reference to that resource will resolve to a URL in the primary site.

The intent of this mode is to generate a preview of a subset of the content in the site, but still have it appear like a full site.

In this mode, the sitemap, site manifest, and redirects will only contain resources that are provided by the build. That means the resulting site manifest is really only intended for informational and reporting purposes.

Same Site

In same site mode, Atlas imports files for the purpose of making a complete site, even if only a portion of the site is built (i.e., a subset of the content sources). If a resource (such as a page) is not provided by the build, and is found in the site manifest, the reference to that resource will be exactly as it would be had the resource been included in the build. In other words, it will be a same site reference.

The intent of this mode is the be able to build a subset of the content in the site, then overlay that output onto the files in the full site as a way to update it.

In this mode, the sitemap, site manifest, and redirects will be complete, just as if all content sources were included in the build. Any imported resources reflect their state from the last full build and may still differ from the content in the actual content source.

Import Mode Selection

The following table identifies how the import mode is determined based on the configuration.

playbook.site.urlprimary-site-urlurl in site manifestImport mode
undefinedundefinedundefinedsame site
undefinedundefinedhttps://docs.example.orgsharded
https://docs.example.orgundefinedhttps://docs.example.orgsame site
http://localhost:8080undefinedhttps://docs.example.orgsharded
https://docs.example.orgundefinedundefinedsharded
undefined.undefinedsame site
undefined.https://docs.example.orgsame site
https://docs.example.org.https://docs.example.orgsame site
http://localhost:8080.https://docs.example.orgsame site
https://docs.example.org.undefinedsame site
undefinedhttps://docs.example.orgundefinedsharded
undefinedhttps://docs.example.orghttps://docs.example.orgsharded
http://localhost:8080https://docs.example.orghttps://docs.example.orgsharded
undefinedhttp://localhost:8080https://docs.example.orgsharded
https://docs.example.orghttps://docs.example.orghttps://docs.example.orgsame site
https://docs.example.orghttps://docs.example.orgundefinedsame site
https://docs.example.orghttps://dev.docs.example.orghttps://docs.example.orgsharded

The most typical way to enable same site mode is to set the site URL and the primary-site-url attribute to the same value.

Copyright (C) 2022-present by OpenDevise Inc. and the individual contributors to this project.

Use of this software is granted under the terms of the Mozilla Public License Version 2.0 (MPL-2.0).

版本与发布记录

@antora/atlas-extension 共发布 8 个版本,首次发布于 2022/10/11;过去 12 个月发布了 1 个版本。

版本发布日期距今
1.0.0-alpha.6latest2026/10/011 个月前
1.0.0-alpha.52025/09/111.2 年前
1.0.0-alpha.42025/09/101.2 年前
1.0.0-alpha.32025/09/101.2 年前
0.0.2latest-02025/05/211.5 年前
1.0.0-alpha.22023/06/293 年前

关于 @antora/atlas-extension 的常见问题

@antora/atlas-extension 是什么?

An Antora extension that manages references across discrete runs of Antora through the use of a site manifest.

如何安装 @antora/atlas-extension?

在项目目录运行 npm install @antora/atlas-extension,或使用 pnpm add / yarn add / bun add。

@antora/atlas-extension 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/antora__atlas-extension 是否存在。

@antora/atlas-extension 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@antora/atlas-extension 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@antora/atlas-extension 可以商用吗?

@antora/atlas-extension 使用 MPL-2.0 许可。弱 Copyleft:可以商用,也可以和闭源代码一起使用;但如果分发时修改了 MPL 授权的文件,这些文件的修改需以 MPL 开源。以上为概括,不构成法律意见,请以许可原文为准。

@antora/atlas-extension 的下载量有多少?

根据 npm 官方下载统计,@antora/atlas-extension 在 2026/10/06 – 2026/11/04 这 30 天内被下载 12,431 次,日均约 414 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@antora/atlas-extension 还在维护吗?

最新版本 1.0.0-alpha.6 发布于 2026/10/01(1 个月前);至今共发布 8 个版本,其中过去 12 个月发布了 1 个;首次发布于 2022/10/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。