withBase #

Prefixes a site path with the site base. External URLs and # anchors are returned as they are.

Usage #

TypeScript
import { 
withBase
} from 'kawapress'
const
href
=
withBase
('/guide/start', '/docs/')

Parameters

pathstring

The site path, for example /guide/start.

basestring

The site base, for example /docs/.

Returns The path under the base.

Full type signature
TypeScript
function withBase(path: string, base: string): string

Edit this page

Comments