Skip to content

Commit

Permalink
Merge pull request #57 from Ellerbach/mtirion/27-fix-toc-generation
Browse files Browse the repository at this point in the history
Fixed issue with ignoring generated index.md in folder with 1 file
  • Loading branch information
mtirionMSFT authored Aug 21, 2024
2 parents c7ec3de + 455c463 commit 9f72b7f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# User-specific files
*.zip
[Oo]utput/
launchSettings.json

*.rsuser
*.suo
Expand Down
11 changes: 10 additions & 1 deletion src/DocFxTocGenerator/TocGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,16 @@ private static void GetDirectories(DirectoryInfo folder, List<string> order, Toc

if (subFiles.Length == 1 && dirInfo.GetDirectories().Length == 0)
{
newTocItem.Href = GetRelativePath(subFiles[0].FullName, _options.DocFolder);
if (!string.IsNullOrEmpty(entryFile))
{
// if we have added an index file, so we'll point to that one
newTocItem.Href = GetRelativePath(entryFile, _options.DocFolder);
}
else
{
// otherwise: the first file.
newTocItem.Href = GetRelativePath(subFiles[0].FullName, _options.DocFolder);
}
}
else
{
Expand Down

0 comments on commit 9f72b7f

Please sign in to comment.