You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Detection rules landing page ignores frontmatter in index.md #4697
The detection rules extension builds the landing page of a detection rules docset, its index.md, from generated Markdown. It never reads the file's own contents. Because frontmatter is only read from the parsed document, any frontmatter in index.md is silently dropped, including mapped_pages.
DetectionRuleOverviewFile overrides GetMinimalParseDocumentAsync and GetParseDocumentAsync to parse the string returned by GetMarkdown(). That string starts with # Prebuilt detection rules reference and has no frontmatter.
MarkdownFile.ProcessYamlFrontMatter only reads frontmatter when the parsed document's first block is a YamlFrontMatterBlock. For this page it never is, so mapped_pages, description, and the other keys have no effect.
Impact: the Prebuilt detection rules reference can't list its 8.x equivalents (/guide/en/security/<version>/prebuilt-rules.html) in the version menu. That was requested in elastic/docs-content-internal#750.
How can we reproduce it?
Add frontmatter to docs/index.md in elastic/detection-rules:
The generated reference/security/prebuilt-rules page has no legacy versions, and none of the frontmatter is applied.
Possible fix: in DetectionRuleOverviewFile.GetMarkdown(), put the frontmatter block from SourceFile, if there is one, in front of the generated Markdown. Both parser pipelines already call UseYamlFrontMatter(), so ProcessYamlFrontMatter would then pick it up.
Activity