@@ -23,7 +23,12 @@ class StaticSiteContext(
23
23
val docsPath = root.toPath.resolve(" _docs" )
24
24
val blogPath = root.toPath.resolve(" _blog" )
25
25
26
- val relativizeFrom = if args.apiSubdirectory then docsPath else root.toPath
26
+ def relativize (path : Path ): Path =
27
+ if args.apiSubdirectory then
28
+ docsPath.relativize(path)
29
+ else
30
+ val relativised = docsPath.relativize(path)
31
+ Paths .get(" docs" ).resolve(relativised)
27
32
28
33
val siteExtensions = Set (" .html" , " .md" )
29
34
@@ -47,7 +52,7 @@ class StaticSiteContext(
47
52
val redirectFrom = loadedTemplate.templateFile.settings.getOrElse(" page" , Map .empty).asInstanceOf [Map [String , Object ]].get(" redirectFrom" )
48
53
def redirectToTemplate (redirectFrom : String ) =
49
54
val path = if redirectFrom.startsWith(" /" )
50
- then relativizeFrom .resolve(redirectFrom.drop(1 ))
55
+ then docsPath .resolve(redirectFrom.drop(1 ))
51
56
else loadedTemplate.file.toPath.resolveSibling(redirectFrom)
52
57
val driFrom = driFor(path)
53
58
val driTo = driFor(loadedTemplate.file.toPath)
@@ -93,7 +98,7 @@ class StaticSiteContext(
93
98
}
94
99
95
100
def driFor (dest : Path ): DRI =
96
- val rawFilePath = relativizeFrom. relativize(dest)
101
+ val rawFilePath = relativize(dest)
97
102
val pageName = dest.getFileName.toString
98
103
val dotIndex = pageName.lastIndexOf('.' )
99
104
0 commit comments