BasePath

interface BasePath(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.

This class is essentially an immutable singleton - it is global to the site, and, once set, it cannot be changed.

Inheritors

Types

Link copied to clipboard

Properties

Link copied to clipboard
abstract val value: String

The string value of this base path.

Functions

Link copied to clipboard
open fun prepend(path: String): String
Link copied to clipboard
abstract 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).