@@ -64,13 +64,18 @@ class HtmlRenderer(rootPackage: Member, val members: Map[DRI, Member])(using ctx
6464 children = Nil
6565 ))
6666 case Some (siteContext) =>
67- (siteContext.orphanedTemplates :+ siteContext.indexTemplate()).map(templateToPage(_, siteContext))
67+ // In case that we do not have an index page and we do not have any API entries
68+ // we want to create empty index page, so there is one
69+ val actualIndexTemplate = siteContext.indexTemplates() match
70+ case Nil if effectiveMembers.isEmpty => Seq (siteContext.emptyIndexTemplate)
71+ case templates => templates
72+
73+ (siteContext.orphanedTemplates ++ actualIndexTemplate).map(templateToPage(_, siteContext))
6874
6975 /**
7076 * Here we have to retrive index pages from hidden pages and replace fake index pages in navigable page tree.
7177 */
72- private def getAllPages : Seq [Page ] =
73-
78+ val allPages : Seq [Page ] =
7479 def traversePages (page : Page ): (Page , Seq [Page ]) =
7580 val (newChildren, newPagesToRemove): (Seq [Page ], Seq [Page ]) = page.children.map(traversePages(_)).foldLeft((Seq [Page ](), Seq [Page ]())) {
7681 case ((pAcc, ptrAcc), (p, ptr)) => (pAcc :+ p, ptrAcc ++ ptr)
@@ -83,9 +88,22 @@ class HtmlRenderer(rootPackage: Member, val members: Map[DRI, Member])(using ctx
8388
8489 val (newNavigablePage, pagesToRemove) = traversePages(navigablePage)
8590
86- newNavigablePage +: hiddenPages.filterNot(pagesToRemove.contains)
91+ val all = newNavigablePage +: hiddenPages.filterNot(pagesToRemove.contains)
92+ // We need to check for conflicts only if we have top-level member called blog or docs
93+ val hasPotentialConflict =
94+ rootPackage.members.exists(m => m.name.startsWith(" docs" ) || m.name.startsWith(" blog" ))
95+
96+ if hasPotentialConflict then
97+ def walk (page : Page ): Unit =
98+ if page.link.dri.isStaticFile then
99+ val dest = absolutePath(page.link.dri)
100+ if apiPaths.contains(dest) then
101+ report.error(s " Conflict between static page and API member for $dest. $pathsConflictResoultionMsg" )
102+ page.children.foreach(walk)
103+
104+ all.foreach (walk)
87105
88- val allPages = getAllPages
106+ all
89107
90108 def renderContent (page : Page ) = page.content match
91109 case m : Member =>
0 commit comments