Module perseus::path_prefix[][src]

Expand description

Utilities relating to working with path prefixes for when a site is hosted at a relative path.

Functions

Gets the path prefix to apply in the browser. This uses the HTML <base> element, which would be required anyway to make Sycamore’s router co-operate with a relative path hosting.

Gets the path prefix to apply on the server. This uses the PERSEUS_BASE_PATH environment variable, which avoids hardcoding something as changeable as this into the final binary. Hence however, that variable must be the same as what’s set in <base> (done automatically). Trailing forward slashes will be trimmed automatically.