Audit URL
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.
Model Support
The plugin works with any Kirby model that has a previewUrl
method:
- Pages: Analyze individual page content
- Site: Check site-level SEO (homepage, etc.)
In blueprint templates, you can customize the preview URL per model type if needed, giving you flexibility in what content gets analyzed.
Custom Target URL
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:
- Analyzing external URLs
- Testing staging environments
- Checking specific URL variations
Cross-Origin Analysis
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:
- Same origin: Direct analysis for optimal performance
- Different origin: Automatic proxy routing with transparent handling
Language-Specific Analysis
The plugin respects the language context selected in the Kirby Panel:
- Primary language: Analyzes content in the default language
- Secondary languages: Analyzes translated content versions
The selected language affects:
- Which assessments are available (some readability assessments are language-specific)
- Content analysis accuracy for readability metrics
- Keyphrase analysis effectiveness for SEO assessments
languages/xx.php
match ISO 639-1 standards (e.g., de
for German, fr
for French) for optimal assessment compatibility.Draft Content Analysis
One of the key advantages of using the previewUrl
approach is that draft content can be analyzed before publication:
- Published pages: Analyze live content
- Draft pages: Test SEO before going live
- Preview URLs: Check content with custom parameters
This allows editors to optimize content during the creation process rather than after publication.
Debugging URL Resolution
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.