单一起始路径
start_path
键标识存储库或本地工作树中antora.yml文件相对于存储库根目录的位置。如果内容源根和存储库根相同,则不需要在url
上设置此键。
默认起始路径
默认情况下,Antora假定内容源存储库或本地工作树的根(即url
键的值)也是内容源根。当antora.yml存储在内容源存储库的根目录时,您不需要为正在配置的url
设置start_path
键。
start_path键
如果antora.yml未存储在分配给url
键的内容源存储库的根目录中,则使用start_path
键告诉Antora在哪里找到内容源根。每个url
键只能配置一个start_path
键(不能直接在content
上设置)。
示例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
值。
示例2. 内容源根不位于存储库根目录
📒 存储库 (1) 📂 packages 📂 docs (2) 📄 antora.yml (3) 📂 modules 📂 a-named-module 📂 ROOT
1 | 内容源存储库的根 |
2 | 内容源根 |
3 | 存储在内容源根处的antora.yml文件 |
为了让Antora在示例2中找到内容源根,start_path
键的值需要指向存储antora.yml的目录。
示例3. 分配start_path值
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来定位内容源根。