Reference

$site->url()

Returns the Url

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

Parameters

Name Type Default Description
$language string|null null

Return type

string

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

Example

Fetching the base URL for the site

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

Fetching the base URL for a language

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

Source code

kirby/src/Cms/Site.php#L617