Skip to content

Conversation

@Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Oct 3, 2025

This PR is a draft, it represents a completely new isolated flow for building our navigation using the existing navigation interfaces.

Main effort is ensuring reading the configuration yaml files and building the navigation are isolated by to separate classes.

Isolated Builds:

  • Separate DocumentationSetFile (docset.yml) deserialization.
  • Separate TableOfContentsFile (toc.yml) deserialization.
  • DocumentationSetNavigation uses DocumentationSetFile to build navigation.
  • DocumentationSetNavigation uses reads through toc references and includes the resulting TableOfContentsNavigation in the parent DocumentationSetNavigation or TableOfContentsNavigation

Assembler Builds:

  • Separate SiteNavigationFile deserialization.
  • SiteNavigation uses SiteNavigationFile and a list of DocumentationSetNavigation
  • SiteNavigation picks DocumentationSetNavigation or its nested TableOfContentsNavigation as defined in navigation.yml to build the large site navigation.
  • Setting PathPrefix on TableOfContentsNavigation and DocumentationSetNavigation instances is viral, all nested nodes will reflect the change. (This makes rehoming these nodes under a new path_prefix a lot cleaner)
  • The navigation is in full control of URL building.

All of these exist in Elastic.Documentation.Configuration and a new isolated Elastic.Documentation.Navigation. The new navigation components have extensive tests in new test projects.

Still Todo:

  • The new navigation does not inject DocumentationFile as its .Model yet.
  • Remove all viral properties on MarkdownFile.
  • Replace/remove current navigation items (TableOfContentsTree, DocumentationGroup etc).
  • Ensure the navigation clicks correctly into HtmlWriter and other related navigation components. Most if not all use the navigation interfaces already.
  • Implement updating NavigationIndex and .Parent in the new navigation.
  • Implement more error/warning diagnostics. Especially around URL uniqueness. Conflicting path_prefixes.

…on`:

- Remove redundant `AutoDiscoverFolderFiles` logic, integrating auto-discovery directly into `ResolveFolderRef`.
- Ensure children validation is streamlined across TOC and folder navigation.
- Add validation for duplicate file references in `FileInfoValidationTests`.
- Replace `parentPath` with `parentContextPath` for clarity.
- Remove redundant `ResolveTocPath` method.
- Simplify TOC file path resolution logic.
- Update error messages to include context for better diagnostics.
…ency:

- Remove `parentContextPath` parameter from navigation methods.
- Consolidate logic for TOC path resolution.
- Adjust children validation to rely on pre-resolved paths.
- Update relevant tests to cover new path handling behavior.
…tions:

- Adjust `advancedToc.Path` test to match new path structure (`guides/advanced`).
- Add TODO comments to clarify known TOC children limitations in parent YAML.
…tionSetFile:

- Handle `folder` + `file` combinations as a single `FileRef` or `IndexFileRef`.
- Maintain existing behavior for standalone `file`, `folder`, and `hidden` keys.
- Update variable naming to enhance readability and clarity.
- Introduce `FolderIndexFileRef` to represent YAML `folder` + `file` combinations.
- Update TOC resolution to ensure children resolve relative to folder paths.
- Adjust file reference creation logic to preserve specific types.
- Add comments for clarity and improve edge case handling.
- Add checks to identify files with deep paths and children, suggesting the use of `folder` for better structure.
- Extend test coverage for virtual file scenarios to validate hint emission and suppression.
- Refactor diagnostics in physical docset navigation to include hints while ensuring no errors or warnings occur.
…extend test coverage:

- Add `NormalizeSitePrefix` method to standardize `sitePrefix` with leading slash and no trailing slash.
- Apply normalized `sitePrefix` to navigation URLs.
- Improve `GetDescription` error messaging in `LlmsNavigationEnhancer`.
- Update tests to validate `sitePrefix` normalization and navigation item URL adjustments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants