Configuration
Kirby SEO Audit doesn't require any global configuration. All aspects of the plugin can be configured on a per-section basis. For specific use cases, such as running Kirby inside Docker containers, you can adjust the proxy configuration globally.
Section Properties
label
String
The label
property defines the label of the section. It is provided by the plugin translations based on the current Panel language.
If you want to change the label, you can do so by setting the label
property:
type: seo-audit
label: SEO Report
keyphraseField
String
If you want to include keyword/keyphrase assessments in your SEO analysis, you need to define a field in your blueprint that contains the keyphrase for the given page (or use the keyphrase
property, see below). The editor can then enter the keyword or keyphrase for which he wants the page to rank in Google.
Set the keyphraseField
property to select which field of the current page model contains the keyphrase.
sections:
content:
type: fields
fields:
# Define the keyphrase field
metaKeywords:
label: Meta Keywords
type: text
seoAudit:
type: seo-audit
# Reference the keyphrase field
keyphraseField: metaKeywords
keyphraseField
is defined, all keyphrase assessments will be skipped, unless you explicitly enable them in the assessments
property.keyphrase
String
If you don't want the editor to enter a keyphrase manually, you can set a default keyphrase for SEO analysis or use a Kirby query to resolve the keyphrase dynamically.
For example, this is useful to automatically use the page title as the keyphrase:
type: seo-audit
keyphrase: "{{ page.title.value }}"
synonymsField
String
Add synonyms to your keyphrase to avoid repeating the same keyphrase over and over again. Not only will readers like this, but it will also help Google to better understand what your content is about.
Set the synonymsField
property to select which field of the current page model contains the synonyms.
sections:
content:
type: fields
fields:
metaKeywords:
label: Meta Keywords
type: text
synonyms:
label: Keyword Synonyms
type: tags
seoAudit:
type: seo-audit
keyphraseField: metaKeywords
synonymsField: synonyms
synonyms
Array
Just like the keyphrase
property as an alternative to the keyphraseField
, you can set the synonyms
property directly in the blueprint. This allows you to define synonyms directly in the blueprint without the need for a separate field for an editor to fill in.
type: seo-audit
keyphrase: "{{ page.title.value }}"
synonyms:
- Kirby
- SEO
- Audit
assessments
Array
Kirby SEO Audit comes with a set of assessments that are used to analyze the content of a page. You can enable or disable individual assessments by setting the assessments
property. By default, all assessments are enabled.
An example configuration that only includes a subset of assessments:
type: seo-audit
assessments:
# Select the assessments you want to include
- MetaDescriptionKeyword
- MetaDescriptionLength
- PageTitleWidth
- TextImages
- TextLength
contentSelector
String
The contentSelector
property allows you to define a CSS selector to select the content of the page that should be analyzed. This is useful if you want to exclude certain parts of the page from the SEO analysis, such as the header, footer or sidebar.
By default, the plugin uses the body
tag to select the content of the page. If you want to analyze only the content of a specific element, you can set the contentSelector
property:
type: seo-audit
contentSelector: "#main:not(.sidebar):not(.footer)"
contentSelector
also supports querying for multiple elements. For example, to select all elements with the class .seo-audit-allowed
but exclude elements certain elements with the class .seo-audit-ignore
, you can use the following selector: .seo-audit-allowed > *:not(.seo-audit-ignore)
.To debug which content is used for the SEO analysis, you can set the log level to info
or higher. This will log the extracted HTML to the console:
type: seo-audit
contentSelector: ".seo-audit-allowed > *:not(.seo-audit-ignore)"
logLevel: info
links
Boolean
The analysis paper contains recommendation links to articles on yoast.com that explain the individual assessments in more detail. While these links can be helpful, you may want to disable them for privacy reasons or because you don't want to distract the editor.
Set the links
property to false
to disable any links in the SEO report:
type: seo-audit
links: false
persisted
Boolean
Decide if the audit should be saved to local storage or not. By default, the generated SEO report will be saved to (and read from) the local storage of the browser. This allows the editor to close the panel and return to the SEO audit later without having to re-run the analysis.
To disable persisting the analysis, set the persisted
property to false
:
type: seo-audit
persisted: false
Global Configuration
proxy
Array
The proxy API path is used to fetch the HTML content of the page if the preview URL is not on the same origin as the Panel. This is necessary to avoid CORS issues.
urlResolver
Callable
The urlResolver
property accepts a callable that is used to resolve the URL of the proxy API. This is useful if you run Kirby inside Docker containers and need to resolve the URL to the host machine:
'johannschopplich.seo-audit' => [
'proxy' => [
'urlResolver' => function (string $url) {
$uri = new \Kirby\Http\Uri($url);
if ($uri->domain() === 'http://127.0.0.1:3000') {
$uri->setHost('host.docker.internal');
}
return $uri->toString();
}
]
]
params
Array
Any parameter supported by Kirby's Remote::request()
method can be passed to the proxy API. This is useful if you need to authenticate against the preview URL:
'johannschopplich.seo-audit' => [
'proxy' => [
'params' => [
'basicAuth' => 'user:password'
]
]
]