-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify configuring "related projects" nav area #581
Comments
I agree to both, that it should be better documented and that it is too verbose at the moment. But I'd advice against re-introducing The old, deprecated key is problematic for a number of reasons: 1) It hardcodes the assumption that there is only one extra section, 2) it hardcodes the assumption the section is titled "Related Projects" (outside of TL projects this is not a very realistic assumption), 3) it forces everyone with only slightly different requirements to use an entirely different configuration approach, 4) that other approach would still be too verbose, 5) we'd need to document and explain both approaches which is a confusing mess. I'd suggest that instead we first improve documentation in this project to include at least one concrete example for how to modify the Helium config in One idea would be to add an overload that captures the fact that having only text links is the most common scenario: laikaTheme := tlSiteHelium.value
.site.mainNavigation(appendLinks = Seq(
ThemeNavigationSection("Related Projects",
"http://example-1.com" -> "Example 1",
"http://example-2.com" -> "Example 2"
)
)) which is not too far from: tlSiteRelatedProjects ++= Seq(
"http://example-1.com" -> "Example 1",
"http://example-2.com" -> "Example 2"
) This avoids the scenario of saving 2 lines for some use cases while complicating and essentially worsening the UX for everything else. In my view that would be the best approach in general: Adding improvements for theme configuration to Laika and not this plugin. The distinction between the two is roughly this: Laika's own sbt plugin is very lightweight, with zero dependencies on other sbt plugins, and general purpose. You could manage your recipe collection with it, not just project documentation. |
👍 to Jens comment, Parsley was glad to see that key removed! It was annoying to require related projects when we don't really have any |
That said, what about instead of offering configuration we/Laika offer combinators? So something like: def relatedProjectsNavigation(prjs: (String, String)*) = ThemeNavigationSection(
"Related Projects",
prjs.map {
case (prj, link) => TextLink.external(link, prj)
}: _*) can be provided by someone, then your configuration would be: tlSiteHelium ~= {
import laika.helium.config._
_.site.mainNavigation(appendLinks = Seq(relatedProjectsNavigation(
"typelevel.g8" -> "https://github.com/typelevel/typelevel.g8", "typelevel.g8"),
"sbt" -> "https://www.scala-sbt.org/",
"sbt-crossproject" -> "https://github.com/portable-scala/sbt-crossproject", "sbt-crossproject",
"MiMa" -> "https://github.com/lightbend/mima",
"mdoc" -> "https://scalameta.org/mdoc/",
...)
) |
Imho that only moves the problem: it's still hardcoding one very specific use case without doing anything about the others whereas what I proposed above reduces verbosity for all use cases. I don't see the need to hardcode a specific section headline in the API anywhere. |
I somehow managed to completely miss your proposal being effectively identical to mine but more general 😂, yeah I'm in favour of that |
Right now adding related projects is very verbose (and not well documented);
sbt-typelevel/build.sbt
Lines 223 to 242 in 2e82571
It would be nice if we had a setting key so we can do something like;
Having the more powerful version available is nice, but doing the most common thing should be easy
The text was updated successfully, but these errors were encountered: