Skip to content

Commit 0fb402a

Browse files
committed
FIx breadcrumbs in static pages
1 parent cf5fcc2 commit 0fb402a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

scala3doc/src/dotty/dokka/site/StaticSiteLocationProvider.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@ class StaticSiteLocationProvider(ctx: DokkaContext, pageNode: RootPageNode)
2424
else {
2525
val path = jpath.asScala.toList
2626
val start = if (path.head == "--root--") List("docs") else path.take(1)
27-
val pageName = page.template.file.getName
28-
val dotIndex = pageName.lastIndexOf('.')
29-
val newName = if (dotIndex < 0) pageName else pageName.substring(0, dotIndex)
27+
// Dokka has a bug in location provider that does not properly handles relative paths for leaf nodes
28+
// This forces us to not change default paths on non-leaf nodes
29+
val newName = if page.getChildren.size() > 0 then path.last else
30+
val pageName = page.template.file.getName
31+
val dotIndex = pageName.lastIndexOf('.')
32+
if (dotIndex < 0) pageName else pageName.substring(0, dotIndex)
33+
34+
println(s"Using $newName for ${page.template.file} orignally: $path")
35+
3036
(start ++ path.drop(1).dropRight(1) ++ List(newName)).asJava
3137
}
3238
case page: ContentPage if page.getDri.contains(docsDRI) =>

0 commit comments

Comments
 (0)