Skip to content

Configuration

iRaziul edited this page Mar 22, 2026 · 1 revision

Configuration

Publish the config file if you have not already:

php artisan vendor:publish --tag="seokit-config"

Most projects only need to review a few options in config/seokit.php.

Default Title and Description

'defaults' => [
    'title' => config('app.name'),
    'description' => 'Default site description.',
],

Use these as sensible fallbacks.

Canonical Behavior

'canonical' => null,

Supported behaviors:

  • null uses the current URL
  • 'full' uses the full URL including query string
  • false disables the default canonical tag

Open Graph and Twitter Defaults

'opengraph' => [
    'enabled' => true,
    'defaults' => [
        'site_name' => config('app.name'),
        'type' => 'website',
        'url' => null,
        'locale' => 'en_US',
    ],
],

'twitter' => [
    'enabled' => true,
    'defaults' => [
        'card' => 'summary_large_image',
        'site' => '@yourbrand',
        'creator' => '@yourbrand',
    ],
],

These defaults provide useful social metadata without per-page setup.

Database Table Name

'table_name' => 'seokit',

Change this only if you want a custom table for the HasSeo workflow.

Auto Title From URL

If enabled, SeoKit can infer a title from the last URL segment when you do not set one manually:

'auto_title_from_url' => true,

Example:

  • /blog/laravel-seo-guide becomes Laravel Seo Guide

You can also provide a custom title_inference_callback.

Recommended Starter Config

return [
    'table_name' => 'seokit',
    'auto_title_from_url' => true,

    'defaults' => [
        'title' => config('app.name'),
        'before_title' => null,
        'after_title' => null,
        'title_separator' => ' | ',
        'description' => 'Default site description.',
        'canonical' => null,
        'robots' => 'index, follow',
    ],

    'opengraph' => [
        'enabled' => true,
        'defaults' => [
            'site_name' => config('app.name'),
            'type' => 'website',
            'url' => null,
            'locale' => 'en_US',
        ],
    ],

    'twitter' => [
        'enabled' => true,
        'defaults' => [
            'card' => 'summary_large_image',
            'site' => '@yourbrand',
            'creator' => '@yourbrand',
        ],
    ],

    'json_ld' => [
        'enabled' => true,
        'defaults' => [],
    ],
];

Clone this wiki locally