BasePath

class BasePath(value: String)(source)

Represents a subpath under which the user's entire site is served under.

Its value is always normalized to begin and end with a slash if set (e.g. "/prefix/").

This class is useful to handle the cases where a Kobweb site is rooted under some known nested subfolder. Once configured, Kobweb APIs can handle prepending it automatically on the user's behalf. This is useful in cases where relative paths can't easily be used, e.g. using "/" from anywhere in your site as a link to go back to the home page.

Constructors

Link copied to clipboard
constructor(value: String)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun prependTo(path: String): String

Prepend this base path in front of some target path, if it is absolute (i.e. starting with a slash).

Link copied to clipboard
open override fun toString(): String