diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index d3d8558a..c1e8fc67 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -120,7 +120,8 @@ object TypelevelSitePlugin extends AutoPlugin { tlSiteHeliumExtensions := TypelevelHeliumExtensions( licenses.value.headOption, tlSiteRelatedProjects.value, - tlIsScala3.value + tlIsScala3.value, + tlSiteApiUrl.value ), tlSiteApiUrl := { val javadocioUrl = for { diff --git a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala index 214b633d..2e5d468f 100644 --- a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala +++ b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala @@ -33,10 +33,17 @@ import java.net.URL object TypelevelHeliumExtensions { - @deprecated("Use overload with scala3 parameter", "0.4.7") + @deprecated("Use overload with API url and scala3 parameter", "0.4.7") def apply(license: Option[(String, URL)], related: Seq[(String, URL)]): ThemeProvider = apply(license, related, false) + @deprecated("Use overload with API url and scala3 parameter", "0.4.13") + def apply( + license: Option[(String, URL)], + related: Seq[(String, URL)], + scala3: Boolean): ThemeProvider = + apply(license, related, false, None) + /** * @param license * name and [[java.net.URL]] of project license @@ -44,11 +51,14 @@ object TypelevelHeliumExtensions { * name and [[java.net.URL]] of related projects * @param scala3 * whether to use Scala 3 syntax highlighting + * @param apiUrl + * url to API docs */ def apply( license: Option[(String, URL)], related: Seq[(String, URL)], - scala3: Boolean + scala3: Boolean, + apiUrl: Option[URL] ): ThemeProvider = new ThemeProvider { def build[F[_]](implicit F: Sync[F]): Resource[F, Theme[F]] = ThemeBuilder[F]("Typelevel Helium Extensions") @@ -62,6 +72,11 @@ object TypelevelHeliumExtensions { F.blocking(getClass.getResourceAsStream("helium/site/styles.css")), Path.Root / "site" / "styles.css" ) + .merge( + apiUrl.fold(InputTree[F]) { url => + InputTree[F].addString(htmlForwarder(url), Path.Root / "api" / "index.html") + } + ) ) .addExtensions( GitHubFlavor, @@ -93,4 +108,11 @@ object TypelevelHeliumExtensions { }) .build + private def htmlForwarder(to: URL) = + s"""| + | + | + | + |""".stripMargin + }