0

I am looking for a solution where I can change the generated output of a docfx build based on some parameters during build time. I have seen that there is a filter property in docfx.json where I can filter out some api stuff. But I would like to change the structure/content of my site which is generated from the toc.yml files.

The reason I would like to have this feature is that I generate the documentation specific for every customer we have. Based on the features a customer has registered on our product some pages of the static documentation have to appear and some pages should not be available for this customer.

marco birchler
  • 1,566
  • 2
  • 21
  • 45

1 Answers1

0

This may be something to start with:

File structure

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

customer1/toc.yml

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

customer2/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"
  }
}

Output site structure

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

Result

site/customer1 is a customized landing page and table of contents for Customer 1

site/customer2 is a customized landing page and table of contents for Customer 2

hcdocs
  • 1,078
  • 2
  • 18
  • 30