@@ -64,13 +64,18 @@ class HtmlRenderer(rootPackage: Member, val members: Map[DRI, Member])(using ctx
64
64
children = Nil
65
65
))
66
66
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))
68
74
69
75
/**
70
76
* Here we have to retrive index pages from hidden pages and replace fake index pages in navigable page tree.
71
77
*/
72
- private def getAllPages : Seq [Page ] =
73
-
78
+ val allPages : Seq [Page ] =
74
79
def traversePages (page : Page ): (Page , Seq [Page ]) =
75
80
val (newChildren, newPagesToRemove): (Seq [Page ], Seq [Page ]) = page.children.map(traversePages(_)).foldLeft((Seq [Page ](), Seq [Page ]())) {
76
81
case ((pAcc, ptrAcc), (p, ptr)) => (pAcc :+ p, ptrAcc ++ ptr)
@@ -83,9 +88,22 @@ class HtmlRenderer(rootPackage: Member, val members: Map[DRI, Member])(using ctx
83
88
84
89
val (newNavigablePage, pagesToRemove) = traversePages(navigablePage)
85
90
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)
87
105
88
- val allPages = getAllPages
106
+ all
89
107
90
108
def renderContent (page : Page ) = page.content match
91
109
case m : Member =>
0 commit comments