Search code examples
c#visual-studio-2017docfx

Docfx 3.0.0 How to get the TOC on the Index.html


This question is the same as this question. But the OP answered his own question and it didn't help me.

I am trying to create a documentation similar to the Docfx site: Docfx home page

However, when I build the project, I get the index.html that looks like this: My home page

My configuration is this:

  • Installed docfx.console as a nuget package in Visual Studio 2017 for the project.
  • The version of docfx is 2.58.0.
  • I'm building the project in Visual Studio, which produces the docfx output.

My folder configuration is:

+MyApp.sln
 |-MyApp
   MyApp.csproj
   docfx.json
   toc.yml
   index.md
 |-_site
 |- api
   index.md
   toc.yml
 |-articles
   intro.md
   toc.md

I can see that all the files are generating, but the TOC does not get put on to the index.html. The Docfx tutorial is not very helpful since it hasn't been upgraded to the newest version. For instance, docfx init does not run, I have to use docfx new conceptual. I have tried:

  • Running docfx new conceptual from a command prompt in the same directory as the docfx.json
  • Running docfx build from a command prompt in the same directory as the docfx.json
  • Running docfx serve _site --port 8182 from the same directory. However, when this is done, my browser tells me to check my proxy settings.

In everything I tried to do, I may have upgraded my docfx version in one place, but not in Visual Studio because when running docfx serve I get the following Content root path: Content root path But I am unsure of how to revert or if I need to.

I'm definitely in a locked-down security environment and I suspect that has something to do with it. Does anyone know of how what files I can alter, if any, to get the TOC on the same page as the index.html? I don't mind writing this by hand, if needed, if I'll only need to do it once in a configuration file.


Solution

  • I finally found the problem. The issue for me was the folder configuration. I had to move my docfx.json, toc.yml, and index.md to the top level where my .sln file was because it was accessing multiple .csproj files. I didn't realize that the top-level toc.yml could only access folders under it's current location.

    Furthermore, the top-level toc.yml will only create the menu items across the top of the page. The lower-level toc files will create the TOC on the left side of the page.

    It took some digging into the tutorial to figure this out.