# Custom Routes

{% hint style="info" %}
Custom routes require the [Pro edition](/getting-started/editions.md).
{% endhint %}

## Seo::data()

Use the `Seo::data()` fluent builder to add SEO metadata to custom routes:

```php
use Aerni\AdvancedSeo\Facades\Seo;

Route::statamic('/login', 'login', [
    'title' => 'Login',
    ...Seo::data()
        ->title('Login')
        ->description('Welcome back! Login to your account.')
        ->toArray(),
]);
```

This also works with regular Laravel routes:

```php
Route::get('/login', function () {
    return view('login', [
        'title' => 'Login',
        ...Seo::data()
            ->title('Login')
            ->description('Welcome back! Login to your account.')
            ->toArray(),
    ]);
});
```

### Available Methods

| Method                   | Description                                                                                   |
| ------------------------ | --------------------------------------------------------------------------------------------- |
| `title(string)`          | Set the meta title.                                                                           |
| `description(string)`    | Set the meta description.                                                                     |
| `ogTitle(string)`        | Set the Open Graph title.                                                                     |
| `ogDescription(string)`  | Set the Open Graph description.                                                               |
| `ogImage(string\|Asset)` | Set the Open Graph image. Accepts a URL or Statamic Asset.                                    |
| `noindex()`              | Mark the page as noindex.                                                                     |
| `nofollow()`             | Mark the page as nofollow.                                                                    |
| `canonicalUrl(string)`   | Set a custom canonical URL.                                                                   |
| `jsonLd(string\|Type)`   | Set JSON-LD structured data. Accepts a raw JSON string or a `Spatie\SchemaOrg\Type` instance. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://advanced-seo.michaelaerni.ch/extending/custom-routes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
