基于DocFx中的构建参数禁用toc项



我正在寻找一种解决方案,在该解决方案中,我可以在构建期间根据一些参数更改docfx构建的生成输出。我看到docfx.json中有一个filter属性,我可以在其中过滤掉一些api内容。但我想更改我的网站的结构/内容,它是从toc.yml文件生成的。

我之所以想要这个功能,是因为我为我们的每个客户生成了特定的文档。根据客户在我们产品上注册的功能,必须显示静态文档的某些页面,而某些页面不应提供给该客户。

这可能是一个开始:

文件结构

articles
--topic1.md
--topic2.md
--topic3.md
--topic4.md
customer1
--index.md
--toc.yml
customer2
--index.md
--toc.yml

客户1/toc.yml

- name: Customer 1 home
homepage: index.md
- name: Topic 1
href: ../articles/topic1.md
- name: Topic 2
href: ../articles/topic2.md

客户2/toc.yml

- name: Customer 2 home
homepage: index.md
- name: Topic 1
href: ../articles/topic1.md
- name: Topic 2
href: ../articles/topic2.md
- name: Topic 3
href: ../articles/topic1.md
- name: Topic 4
href: ../articles/topic2.md

docfx.json

{
"build": {
"content": [
{
"files": [
"articles/*.md",
"customer1/**",
"customer2/**"
]
}
],
"dest": "_site"
}
}

输出站点结构

articles
--topic1.html
--topic2.html
--topic3.html
--topic4.html
customer1
--index.html
--toc.html
customer2
--index.html
--toc.html

结果

site/customer1是为客户1 定制的登录页和目录

site/customer2是为客户2 定制的登录页和目录

最新更新