XF 2.3 Remove the "itemReviewed" property to avoid a directional conflict

Recep Baltaş

Well-known member
Licensed customer
Following a recent Xenforo update, I started receiving the following structured data error in Google Search Console:

Code:
A nested "<parent_node>" item may not contain the "itemReviewed" property. Remove the "itemReviewed" property to avoid a directional conflict. The "<parent_node>" type is not compatible with this item.

It appears there is a schema markup issue where the itemReviewed property is incorrectly nested within <parent_node> object in the updated templates.

Could you please look into this directional conflict, or advise on which specific template needs to be modified to resolve the schema error?

Thanks
 
Create a template modification - xfrm_resource_view

Find

Code:
<xf:page option="ldJsonHtml">
    <script type="application/ld+json">
        {{ $resource.getLdStructuredData()|json(true)|raw }}
    </script>
</xf:page>
Replace
Code:
<xf:set var="$resourceUrl" value="{{ link('canonical:resources', $resource) }}" />
<xf:set var="$discussionUrl" value="{{ $resource.hasViewableDiscussion() ? link('canonical:threads', $resource.Discussion) : $resourceUrl }}" />
<xf:set var="$authorUrl" value="{{ $resource.User ? link('canonical:members', $resource.User) : $resourceUrl }}" />
<xf:set var="$authorName" value="{{ $resource.User ? $resource.User.username : $resource.username }}" />
<xf:set var="$descFull" value="{{ snippet($description.message, 5000, {'stripBbCode': true}) }}" />
<xf:set var="$currency" value="{{ $xf.options.currencyCode ?: 'EUR' }}" />

<xf:set var="$allReactions" value="0" />
<xf:if is="$description.reactions">
    <xf:foreach loop="$description.reactions" value="$cnt">
        <xf:set var="$allReactions" value="{{ $allReactions + $cnt }}" />
    </xf:foreach>
</xf:if>

<xf:page option="ldJsonHtml">
    <script type="application/ld+json">
    {
        "@context": "https://schema.org",
        "@type": "SoftwareApplication",
        "@id": "{{ $resourceUrl|escape('json') }}#app",
        "name": "{{ $resource.title|escape('json') }}",
        "description": "{{ $descFull|escape('json') }}",
        "url": "{{ $resourceUrl|escape('json') }}",
        "image": "{{ $resource.getIconUrl(true)|escape('json') }}",
        "applicationCategory": "{{ $resource.Category.title|escape('json') }}",
        "operatingSystem": "Windows 7, Windows 10, Windows 11",
        "datePublished": "{{ date($resource.resource_date, 'c')|escape('json') }}",
        "dateModified": "{{ date($resource.last_update, 'c')|escape('json') }}",
        "discussionUrl": "{{ $discussionUrl|escape('json') }}",
        "author": {
            "@type": "Person",
            "name": "{{ $authorName|escape('json') }}",
            "url": "{{ $authorUrl|escape('json') }}"
        },
        "publisher": {
            "@type": "Organization",
            "name": "{{ $xf.options.boardTitle|escape('json') }}"
        },
        "offers": {
            "@type": "Offer",
            "price": {{ $resource.price ?: 0 }},
            "priceCurrency": "{{ $currency|escape('json') }}"
        }
        <xf:if is="$allReactions > 0 OR $resource.view_count > 0">
        ,
        "interactionStatistic": [
            <xf:if is="$allReactions > 0">
            {
                "@type": "InteractionCounter",
                "interactionType": "https://schema.org/LikeAction",
                "userInteractionCount": {{ $allReactions }}
            }<xf:if is="$resource.view_count > 0">,</xf:if>
            </xf:if>
            <xf:if is="$resource.view_count > 0">
            {
                "@type": "InteractionCounter",
                "interactionType": "https://schema.org/ViewAction",
                "userInteractionCount": {{ $resource.view_count }}
            }
            </xf:if>
        ]
        </xf:if>
        <xf:if is="$resource.rating_count > 0">
        ,
        "aggregateRating": {
            "@type": "AggregateRating",
            "ratingValue": {{ $resource.rating_avg }},
            "ratingCount": {{ $resource.rating_count }},
            "bestRating": 5,
            "worstRating": 1
        }
        </xf:if>
    }
    </script>
</xf:page>
After that, copy the resource URL and paste it here for testing - https://search.google.com/test/rich-results
If no errors shown, then everything works.
 
Back
Top Bottom