Docfx: Automatically generate TOC from folder structure

Created on 27 Jul 2018  路  9Comments  路  Source: dotnet/docfx

DocFX Version Used:
2.34
Template used: (default or statictoc or contain custom template)
default with small customizations

Actual Behavior:
Is it possible to have the toc automatically generated from the folder structure of my documentation? I have a lot of markdown documentation already organized in folders. I would like docfx to simply build a site that uses the existing organization as the toc. It seems like unnecessary busy work to have to add each of my markdown files to a toc file so that they are visible in the UI.

feature-request v3

Most helpful comment

I'd really like to see this feature added to DocFx. :-)

All 9 comments

When docfx generates the following error:

https://github.com/dotnet/docfx/blob/55311684642506280bc8daf02e65745ffa515d76/src/Microsoft.DocAsCode.Build.TableOfContents/TocResolver.cs#L111

Instead of that error it would be nice if we could auto generate the toc from the folder structure.

How would you like to order the files in TOC?

@yufeih typically a directory lists alphabetical. Would be fine with me.

Grav uses numbers in file names determine the order, these numbers are removed in URL:

01. page-1.md
02. page-2.md

How would you like to order the files in TOC?

What about specifying the position of each item in the TOC using a property in the YAML Header?

---
index: 2
---

And if there are two files with the same index or it is not set, they are ordered alphabetically.

Hi, we are doing something for the Umbraco documenation here: https://github.com/dampee/DocFxTocGenerate

I'd really like to see this feature added to DocFx. :-)

MS DevOps Wikis generate a File named '.order' per Folder where the File Names are listed URL-escaped, one per Line.
I don't know what happens when there are Files missing in this List, by personally I would place those missing last and in alphabetic order.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mgregory22 picture mgregory22  路  3Comments

CodingBeagle picture CodingBeagle  路  5Comments

superyyrrzz picture superyyrrzz  路  3Comments

vicancy picture vicancy  路  4Comments

ntvuong1709it picture ntvuong1709it  路  4Comments