# url()

Builds an absolute URL for a given path

****

- Source: <https://github.com/getkirby/kirby/tree/5.5.3/config/helpers.php#L623>

****

```php
url(string|null $path = null, array|string|null $options = null): string
```

## Parameters

| Name | Type | Default | Description |
| ---- | ---- | ---- | ---- |
| `$path` | `string` or `null` | `null` | – |
| `$options` | `array`, `string` or `null` | `null` | – |

## Return type

`string`

## Examples

Generate a link to a page, e.g. search

```php
<a href="<?= url('search') ?>">Search</a>
```

Generate a link to a page with query string:

```php
<a href="<?= url('search', ['query' => ['q' => 'validators', 'area' => 'reference']]) ?>">Search</a>
```

Generate a link to a page with params:

```php
<a href="<?= url('blog', ['params' => ['category' => 'travel', 'tag' => 'beach']]) ?>">Search</a>
```