The Kirby SEO Audit plugin automatically determines which URL to analyze by retrieving the previewUrl of the current Kirby model. This means the URL used for SEO analysis is the same as the one opened by clicking the open button in the Panel, ensuring that even draft pages can be SEO-checked.
The plugin fetches the HTML content from the preview URL, performs the analysis using the built-in SEO and readability assessments, and displays the report.
The plugin works with any Kirby model that has a previewUrl method:
In blueprint templates, you can customize the preview URL per model type if needed, giving you flexibility in what content gets analyzed.
In certain cases, you might want to customize the target URL used to generate the SEO report. This can be done by adding a preview option to the model's blueprint:
options:
preview: https://getkirby.com/features/developers
sections:
seoAudit:
type: seo-audit
This is particularly useful for:
When the preview URL origin differs from the Panel origin, the plugin automatically routes requests through an internal proxy to avoid CORS (Cross-Origin Resource Sharing) issues. This seamless handling ensures analysis works regardless of your setup:
The plugin respects the language context selected in the Kirby Panel:
The selected language affects:
languages/xx.php match ISO 639-1 standards (e.g., de for German, fr for French) for optimal assessment compatibility.One of the key advantages of using the previewUrl approach is that draft content can be analyzed before publication:
This allows editors to optimize content during the creation process rather than after publication.
To understand which URL is being analyzed, you can enable debug logging:
return [
'johannschopplich.seo-audit' => [
'logLevel' => 'info'
]
]
This will log information about the resolved preview URL and the HTML extracted for analysis. You can inspect these logs in your browser's developer console.