prependTo

open override fun prependTo(path: String): String(source)

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

If the path is a relative path, it will be returned unchanged.

For example, if this site's base path is "prefix", then...

  • path == "subdir" ->"subdir"

  • path == "/subdir" ->"/prefix/subdir"

By only working on absolute routes, we'll never accidentally prepend a base path onto a sub-route where any middle parts are missing.