单个开始路径
start_path
键标识了与存储库的根相对应的存储库或本地工作树中 antora.yml
文件的位置。如果内容源的根和存储库的根相同,则不需要在 url
上设置此键。
默认起始路径
默认情况下,Antora 假定内容源存储库或本地工作树的根(即 url
键的值)也是内容源根。当 antora.yml
存储在内容源存储库的根处时,您不需要为正在配置的 url
设置 start_path
键。
start_path 键
如果 antora.yml
没有存储在分配给 url 键的内容源存储库的根目录中,则使用 start_path
键告诉 Antora 在哪里查找内容源根。每个 url
键只能配置一个 start_path
键(不能直接在 content
中设置)。
Example 1. Example 1. antora-playbook.yml
content:
sources:
- url: https://git-service.com/org/repo.git
branches: [main, v1.0]
start_path: path/to/content-source-root
start_path
键接受存储库根相对路径。不要在路径中添加前导或尾随斜杠。
指定 url 键的 start_path
start_path
键的值是到内容源根的存储库相对路径。让我们为示例2中所示的存储库定义一个 start_path
值。
Example 2. Example 2. Content source root isn’t located at the repository root
📒 repository (1)
📂 packages
📂 docs (2)
📄 antora.yml (3)
📂 modules
📂 a-named-module
📂 ROOT
1 | 内容源存储库的根 |
2 | 内容文档源根 |
3 | antora.yml 文件存储在内容文档源根 |
为了使 Antora 在示例2中定位到内容源根目录,start_path
键的值需要指向存储有 antora.yml
的目录。
Example 3. Example 3. Assign start_path value
content:
sources:
- url: https://gitlab.com/org/repo.git
branches: [v1.0, v2.6]
start_path: packages/docs (1)
1 | 到内容源根的存储库相对路径 |
使用示例3中指定的 start_path
,Antora 将在每个分支下使用路径 https://gitlab.com/org/repo/-/tree/vx.x/packages/docs
来定位内容源根目录。