diff --git a/.gitignore b/.gitignore index e7bb183..14bd891 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # User-specific files *.zip [Oo]utput/ +launchSettings.json *.rsuser *.suo diff --git a/src/DocFxTocGenerator/TocGenerator.cs b/src/DocFxTocGenerator/TocGenerator.cs index 8151697..f319fd0 100644 --- a/src/DocFxTocGenerator/TocGenerator.cs +++ b/src/DocFxTocGenerator/TocGenerator.cs @@ -403,7 +403,16 @@ private static void GetDirectories(DirectoryInfo folder, List 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 {