Content fetchers
Added in v5.6.2 .
|
Some auditors check on rendered content rather than the content node itself. These auditors need some way to get the content before checking it and use a "content fetcher" to retrieve the content for them.
These auditors use content fetchers:
-
HtmlElementAuditor - to check rendered HTML elements
-
LinkAuditor - to check rendered links
-
ParagraphLengthAuditor - to check rendered text
-
ValidHtmlAuditor - to check the HTML of a rendered page
Each of these auditors must have a content fetcher configured to carry out its checks.
RequestFetcher
RequestFetcher
sends a preview request to Magnolia to render content and captures the page returned. You have to configure RequestFetcher
to send a preview request through its configuration properties.
- Class
-
info.magnolia.services.seo.audit.impl.RequestFetcher
RequestFetcher
has the following properties:
Property | Description | ||
---|---|---|---|
|
optional The template for the preview request. The template should have a placeholder If you set your own request template, the content node path substituted will always start with a "/". You don’t need to add a "/" to separate the host name and port from the node path in your request template. The default value of
Also, the query string of the request template specifies that it is a preview request ( You could also use the personalization preview parameters in the query string of the request template to preview the page as a given persona:
|
||
|
optional Defines a list of credentials (host, port, user name and password) when requesting rendered content. The credentials will be added to the preview request and will be available as preemptive basic authentication.
|
Configuring credentials
The targets nodes allows you to define one or more credentials that will be added to each preview request used to render content. You will probably have to define credentials for accessing links to your Magnolia instance if it is an author instance; pages and resources are protected with basic authentication.
The credentials will be added by host, so more than one credentials can be added.
Here is how to configure target credentials within your RequestFetcher
configuration:
Property | Description |
---|---|
|
|
|
required The name of the credentials. |
|
required The credentials class name, should be |
|
required The host or domain name for the credentials. |
|
required The port. |
|
optional The scheme (e.g. The default value for scheme is |
|
required The user name. |
|
required The user’s password. |
|
optional If The default value for preemptive is |
Example
Here is an example from the SEO module. You can find this configuration here: /modules/seo/config/auditManager/auditors/deadLinks/fetcher
.
fetcher:
class: info.magnolia.services.seo.audit.impl.RequestFetcher
targets:
localhost:
class: info.magnolia.services.seo.audit.impl.HostTarget
host: localhost
password: superuser
port: 8080
scheme: http
user: superuser
RenderingFetcher
- Class
-
info.magnolia.services.seo.audit.impl.RenderingFetcher
RenderingFetcher
renders content by directly invoking the Magnolia rendering engine and capturing the results.
Since RenderingFetcher
does not send a request to Magnolia. It may be slightly faster than RequestFetcher
but may not correctly render the content when using personalization or sites.
RenderingFetcher
has no configuration properties.