I'm trying to create a seamless version switch exp...
# dokka
o
I'm trying to create a seamless version switch experience with an MkDocs- and Dokka-generated site. I'm creating the whole static site locally without any strange "gh-pages" branch tweaking. With MkDocs it's easy, I can just create the versions file and version directories and the version dropdown will just be there, even from older versions to newer ones. With Dokka, it seems like I can only go backwards, because all "older" versions are hardwired at creation time, and newer versions won't be seen as they arrive. Is my understanding correct?
h
It depends on your setup. How do you keep the old versions?
o
In one directory as described here:
Copy code
dokka {
    pluginsConfiguration {
        versioning {
            version = newApiVersion
            versionsOrdering = listOf(newApiVersion) + previousVersions
            olderVersionsDir = apiVersionsDirectory
        }
    }
}
h
So you checkin your (old) apis? Ktor does the same and you can visit all different versions https://api.ktor.io/index.html
Or I don’t understand your problem.
o
Yes, the old APIs land in git. But seemingly the versions (current and old ones) are hardwired into Dokka-generated HTML/JS. Don't know how Ktor folks did it.
c
Alternative solution: put the dokka output in the MavenCentral JAR and let
javadoc.io
deal with versioning.
o
Interesting. Does it have to be in the javadoc format or do they support Dokka HTML as well?
c
If you want to use it: • Each time you create a new Maven artifact you need to navigate to it once to register it (or any of your users can do it too) • After that, it checks for new versions automatically every few days • The main page, https://javadoc.io lets you find out the URLs & generate badges The author has helped me in the past fix a link issue in the Dokka format, so he's not opposed to it
o
Is javadoc.io a new project? Tried with compat-parameterize, switched to 2.1.0, then it took quite a while to load (showing just a blank page), then it rendered an unstyled page without the navigation on the left.
c
No, it's been here for years, but my javadoc setup was broken for a few versions 😕
Or maybe he has issues right now, it does seem slow 👀
o
My goals are: Test docs locally before releasing, without modifying anything in the release process. Have my docs up and current whenever a new release is published (so no delays). Being able to fix docs for past versions if necessary. javadoc.io seems nice and convenient, but it could not align with these goals, right?
c
Test docs locally before releasing, without modifying anything in the release process
javadoc.io just serves the Dokka output and adds the 'version switch' header. Other than that, everything else is the same as local.
Have my docs up and current whenever a new release is published (so no delays)
If you go on the website and press the 'refresh' button it takes ~3 minutes to refresh. I'm sure it's not too hard to script that into your release process if you really want to.
Being able to fix docs for past versions if necessary
That's a hard no. It displays the contents of the MavenCentral, which are immutable (for good reasons).
o
javadoc.io just serves the Dokka output and adds the 'version switch' header. Other than that, everything else is the same as local.
Who would handle cross-artifact navigation?
o
With Dokka, it seems like I can only go backwards, because all "older" versions are hardwired at creation time, and newer versions won't be seen as they arrive. Is my understanding correct?
Yes, with Dokka's
versioning
plugin, that's correct. For each new version, you need to regenerate the documentation, using the previous output. It's known that it's not ideal. I do know that Apollo has some setup to publish and download multi-module HTML for every version, but as you check it out in the git, you can reuse it, of course. Regarding javadoc.io, the main problem is that it hosts artifacts per module, so you need to manually set up external documentation links between them via the same mechanism as links to the standard library and other libraries are configured. Dokka does this for a multi-module case automatically (via a bit different mechanism)
thank you color 1