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:

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

requestTemplate

optional

The template for the preview request. The template should have a placeholder "{0}" for the path of the selected content node being rendered.

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 requestTemplate is:

http://localhost:8080{0}?mgnlPreview=true&mgnlChannel=desktop

The default requestTemplate will send its preview request to the local Magnolia instance listening on port 8080.

Also, the query string of the request template specifies that it is a preview request ("mgnlPreview=true") and to render the page as if being viewed in a desktop browser ("mgnlChannel=desktop").

You could also use the personalization preview parameters in the query string of the request template to preview the page as a given persona:

http://localhost:8080{0}?previewPersona=<persona name>&mgnlPreviewAsVisitor=true

targets

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.

Accessing pages on the standard Magnolia author instance require authentication. You should configure credentials for accessing your local Magnolia author instance.

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

targets

     <target credentials name>

required

The name of the credentials.

             class

required

The credentials class name, should be info.magnolia.services.seo.audit.impl.HostTarget.

             host

required

The host or domain name for the credentials.

             port

required

The port.

             scheme

optional

The scheme (e.g. http, https, …​)

The default value for scheme is http.

             user

required

The user name.

             password

required

The user’s password.

             preemptive

optional

If true the credentials will be added to requests with preemptive basic authentication.

The default value for preemptive is true.

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.

Example

Here is an example RenderingFetcher configuration:

fetcher:
  class: info.magnolia.services.seo.audit.impl.RenderingFetcher
Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the SEO module docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules