From bf78e55f0705d44749e9dfad7de1c0c9fb4e32ba Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 18 Aug 2026 16:21:23 +0200 Subject: [PATCH] Infer listing group from parent directory when listing: frontmatter is absent Content files inside a group subdirectory (e.g. reference/indentation/foo.md) are automatically assigned to that group without requiring an explicit listing: indentation in their frontmatter. The frontmatter key still takes precedence when present. Co-Authored-By: Claude Sonnet 4.6 --- .../Toc/DocumentationSetFile.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs b/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs index f29db26c9..232dfbc83 100644 --- a/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs +++ b/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs @@ -860,6 +860,16 @@ static void CollectExcluded(IReadOnlyCollection items, Has foreach (var file in contentFiles) { var group = fileGroups[file]; + + // If listing: frontmatter is absent, infer the group from the parent directory + // when that directory is a known group folder (has a group index file). + if (string.IsNullOrEmpty(group) && file.Directory is not null) + { + var parentRel = Path.GetRelativePath(listingDirAbsolute, file.Directory.FullName).Replace('\\', '/'); + if (groupIndexFiles.ContainsKey(parentRel)) + group = parentRel; + } + if (!string.IsNullOrEmpty(group)) { if (!groupedFiles.ContainsKey(group))