kobweb
kobweb copied to clipboard
Allow the user to generate pages at build (or export?) time
This will need a design pass. But basically, similar to what next.js is doing with static props - for example, maybe you can query a database and generate the top-level blog indexing site dynamically from it (e.g. maybe top five most visited articles, etc.)
Note that I'm doing this in my own blog site now simply by adding logic to my build.gradle file:
https://github.com/bitspittle/bitspittle.dev/blob/9da7def42a8b9a5481fe9805ac47de37e39f9576/build.gradle.kts#L142
so it's quite possible that we never need to do anything ourselves in Kobweb.
That said, I should review what I'm doing in my blog site and see if I could possibly expose some sort of API which makes doing what I'm doing easier to do.
So, yeah, at this point best practice is to
- create a Gradle task which generates code into a folder which is the task's output
- add that task as a source set directory, as in
jsMain { kotlin.srcDir(genStuffTask) }