PHP code example of tearoom1 / kirby-meta-kit

1. Go to this page and download the library: Download tearoom1/kirby-meta-kit library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tearoom1 / kirby-meta-kit example snippets


<head>
     snippet('meta-kit/seo') 

return [
    'tearoom1.meta-kit' => [
        // Optional: Add AI features
        'api.key' => 'sk-or-v1-YOUR-KEY',
        'api.model' => 'google/gemma-4-31b-it:free',
    ]
];

'tearoom1.meta-kit' => [
    'api.provider' => 'openrouter',   // 'openrouter', 'mistral' or 'custom'
    'api.key' => 'sk-or-v1-YOUR-KEY',
    'api.model' => 'google/gemma-4-31b-it:free',
    'ai.enabled' => true,             // false hides every AI feature
    'review.enabled' => false,        // opt-in: experimental AI content review
    'allowedRoles' => [],             // roles besides admin that may use Meta Kit
    'excludeTemplates' => [],         // templates hidden from the Panel table
    'validation' => [],               // length ranges, see Validation
    'sitemap.enabled' => true,
    'languages.available' => null,    // callback: does a page exist in a language?
    'robots' => ['enabled' => true, 'blockBadBots' => true, 'blockAiCrawlers' => false],
    'redirects.enabled' => true,
    'llms.enabled' => false,
]

'validation' => [
    'ranges' => ['title' => ['optimal' => ['min' => 30, 'max' => 60]]],
    'templates' => [
        'article' => ['title' => ['optimal' => ['min' => 40, 'max' => 70]]],
    ],
]

$page->metaTitle()->value();            // the stored fields
$page->ogImage()->toFile();
$page->generateSeoTitle();               // AI generation from code
$page->generateSeoDescription($text, 'de');
$page->text()->toSeoDescription();       // any field to an SEO text