varabyte / kobweb

A modern framework for full stack web apps in Kotlin, built upon Compose HTML
https://kobweb.varabyte.com
Apache License 2.0
1.46k stars 65 forks source link

Allow Kobweb config to support rooting your site in a subfolder (e.g. to support GitHub Pages) #126

Closed bitspittle closed 2 years ago

bitspittle commented 2 years ago

If you create a GitHub Pages site, it puts your page under a subfolder of the parent domain.

So for example, my repo "bitspittle/kobweb-ghp-demo" creates a site rooted at https://bitspittle.github.io/kobweb-ghp-demo/

However, Kobweb normally encourages rooting your paths, e.g. "/markdown" or "/site.js" This works fine if you own the root domain but is clearly a problem now, because if you click on such a link, you'd go from:

https://bitspittle.github.io/kobweb-ghp-demo/

to

https://bitspittle.github.io/markdown

The way forward is probably adding a siteSubpath field in the conf.yaml which somehow the router too can know about. So "/markdown" would translate to https://bitspittle.github.io/kobweb-ghp-demo/markdown

bitspittle commented 2 years ago

This is now accomplished using the routePrefix feature. Although there are no official docs for it at this time (follow #133 if you want to see if this is still true), I actually blogged about the feature in case anyone sees this comment and wanted to read up on it: https://bitspittle.dev/blog/2022/staticdeploy#github-pages