@@ -26,7 +26,8 @@ public TableOfContentsNavigation(
2626 string pathPrefix ,
2727 IReadOnlyCollection < INavigationItem > navigationItems ,
2828 GitCheckoutInformation git ,
29- Dictionary < Uri , INodeNavigationItem < IDocumentationFile , INavigationItem > > tocNodes
29+ Dictionary < Uri , INodeNavigationItem < IDocumentationFile , INavigationItem > > tocNodes ,
30+ INavigationHomeProvider homeProvider
3031 )
3132 {
3233 TableOfContentsDirectory = tableOfContentsDirectory ;
@@ -38,10 +39,11 @@ Dictionary<Uri, INodeNavigationItem<IDocumentationFile, INavigationItem>> tocNod
3839 Id = ShortId . Create ( parentPath ) ;
3940 Depth = depth ;
4041 ParentPath = parentPath ;
41- _pathPrefix = pathPrefix ;
42+ PathPrefix = pathPrefix ;
4243
43- // Initialize _homeProvider to this - it will be updated in assembler builds if needed
44- _homeProvider = this ;
44+ // Initialize _homeProvider from the provided homeProvider
45+ // According to url-building.md: "In isolated builds the NavigationRoot is always the DocumentationSetNavigation"
46+ _homeProvider = homeProvider ;
4547
4648 // Create an identifier for this TOC
4749 Identifier = new Uri ( $ "{ git . RepositoryName } ://{ parentPath } ") ;
@@ -51,20 +53,17 @@ Dictionary<Uri, INodeNavigationItem<IDocumentationFile, INavigationItem>> tocNod
5153 Index = this . FindIndex < IDocumentationFile > ( new NotFoundModel ( $ "{ parentPath } /index.md") ) ;
5254 }
5355
54- private readonly string _pathPrefix ;
55-
5656 /// <summary>
57- /// Internal HomeProvider - defaults to this, but can be updated in assembler builds.
57+ /// Internal HomeProvider - can be updated in assembler builds for rehoming .
5858 /// </summary>
5959 private INavigationHomeProvider _homeProvider { get ; set ; }
6060
6161 /// <summary>
62- /// The composed path prefix for this TOC, which is the parent's prefix + this TOC's parent path.
63- /// This is used by children to build their URLs.
64- /// Implements INavigationHomeProvider.PathPrefix
65- /// When HomeProvider is set (during assembler), this returns the external provider's PathPrefix.
62+ /// The path prefix for this TOC - same as parent per url-building.md.
63+ /// Implements INavigationHomeProvider.PathPrefix.
64+ /// TOC doesn't change PathPrefix from parent.
6665 /// </summary>
67- public string PathPrefix => _homeProvider == this ? _pathPrefix : _homeProvider . PathPrefix ;
66+ public string PathPrefix { get ; }
6867
6968 /// <inheritdoc />
7069 public string Url => Index . Url ;
@@ -73,11 +72,11 @@ Dictionary<Uri, INodeNavigationItem<IDocumentationFile, INavigationItem>> tocNod
7372 public string NavigationTitle => Index . NavigationTitle ;
7473
7574 /// <summary>
76- /// TableOfContentsNavigation is its own NavigationRoot in isolated builds .
77- /// In assembler builds, this can be overridden via HomeProvider.
75+ /// TableOfContentsNavigation's NavigationRoot comes from its HomeProvider .
76+ /// According to url-building.md: " In isolated builds the NavigationRoot is always the DocumentationSetNavigation"
7877 /// This satisfies both INavigationItem.NavigationRoot and INavigationHomeProvider.NavigationRoot.
7978 /// </summary>
80- public IRootNavigationItem < INavigationModel , INavigationItem > NavigationRoot => _homeProvider == this ? this : _homeProvider . NavigationRoot ;
79+ public IRootNavigationItem < INavigationModel , INavigationItem > NavigationRoot => _homeProvider . NavigationRoot ;
8180
8281 /// <inheritdoc />
8382 public INodeNavigationItem < INavigationModel , INavigationItem > ? Parent { get ; set ; }
0 commit comments