Using Kirby SEO
							
						
											
							Advanced
							
						
									
		Docs
		
Computed Content
				Using Kirby SEO
				
			
					
				Advanced
				
			
			By default, the second level of the cascade allows you to specify default content for the SEO fields using a page model.
This is especially helpful if you want a certain field to default to another field's content or you're using a plugin like kirby-paparazzi to programmatically generate OG images. You can also use page models to add custom meta tags to your pages.
An example page model could look like this:
<?php
// site/models/template.php
use Kirby\Cms\Page;
class TemplatePage extends Page
{
	public function metaDefaults(string $lang = null): array
	{
		$content = $this->content($lang);
		return [
			// you can use field names (from blueprint)
			'metaDescription' => $content->summary(),
			// or any meta tag
			'og:image' => "{$this->url()}.png",
			"og:image:width" => 1230,
			"og:image:height" => 600,
			// kirby-seo tries to guess the correct syntax of the tag
			// (e.g. open graph tags always use "property" and "content" attributes)
			// but you can also specify them manually
			[
				'tag' => 'meta',
				'attributes' => [
					"property" => 'og:image:alt',
					"content" => "An image showing the beautiful city of {$this->title()}"
				],
			]
		];
	}
}