Skip to content

Kirby 5.0.4

$site->url()

Returns the Url

$site->url(string|null $language = null): string

Parameters

Name Type Default
$language stringornull null

Return type

string

This method modifies the existing $site object it is applied to and returns it again.

Parent class

Kirby\Cms\Site

If a $lang parameter is specified (multi-language site only), the specific language URL is returned.

Examples

Fetching the base URL for the site

<?= $site->url() ?>

Fetching the base URL for a language

<?= $site->url('en') ?>