The info.magnolia.services.seo.audit.impl.HtmlElementAuditor checks for the presence of a specified HTML element. If the HTML element is found at least once, the audit passes, otherwise the audit fails. This auditor can be applied to any renderable node. The auditor uses jsoup queries to parse and find HTML elements. These queries have a jQuery or CSS like syntax.
If defined, this pattern will be applied to the returned results of the jsoup query. If the pattern does not match a result, then an audit result of level will be marked.
valueFlags
optional
Added in v5.6.5.
Regular expression bit flags for matching. The flags will be applied with any regular expression defined by valuePattern and ignored otherwise.
Defines a message or explanation if a query result does not match valuePattern.
The message can have placeholders that replaced with:
0 - query result
1 - valuePattern
textOnly
optional
Added in v5.6.5.
Controls the text searched by valuePattern.
If set to true, the text will be stripped of all HTML tags and only the the values of HTML tags will be used.
If set to false (the default), the full text including all HTML tags, will be searched.
Example
Here is an example from the SEO module. You can find this configuration here: /modules/seo/config/auditManager/auditors/titleRendered.
titleRendered:auditProperty:titleNotRenderedauditValue:Theheadtitleisnotrenderedinthepage{0}class:info.magnolia.services.seo.audit.impl.HtmlElementAuditordescription:Checkifthetitleisrendered(pre-prod)invalidValue: The head title is not properly rendered:{0}level:auditErrorsquery:titlevaluePattern:<span class="hljs-string">.{1,}</span>fetcher:class:info.magnolia.services.seo.audit.impl.RequestFetchertargets:localhost:class:info.magnolia.services.seo.audit.impl.HostTargethost:localhostpassword:superuserport:8080scheme:httpuser:superuserCopy