XF 2.1 Missing field "position" Breadcrumb markup

Chris D

XenForo developer
Staff member
I've seen this present on one of your sites (Norwich) but cannot reproduce it anywhere else.

The position meta tag is indeed missing for each breadcrumb. This is unexpected. You can see it is present in our Breadcrumb list here:

1568983747900.png

This could be down to outdated templates as I think we may have added this some time after the release of XF 2.0 but certainly not a recent change.
 

Rivmedia

Member
Hi Chris,

Interesting, Yes i have seen it a on a few of our templates. No outdated templates are showing as a notice, maybe its one I dismissed in the past by accident, will review the outdated template list and see if there is anything in there.

Edit, just checked the outdated template list and non are listed. I will compare the templates with the default theme and check any of our custom addons incase they are changing anything to see if i can spot anything.

Thanks again, Will update with what I find.
 

Chris D

XenForo developer
Staff member
It's only one theory and as I said this wouldn't be a recent thing unless you only just recently moved to XF 2.x.

Certainly check to see if your PAGE_CONTAINER template is modified in your style(s), and particularly if this part at the bottom is present and exactly as listed here:
HTML:
<xf:macro name="crumb" arg-href="!" arg-value="!" arg-position="{{ 0 }}">
   <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
      <a href="{$href}" itemprop="item">
         <span itemprop="name">{$value}</span>
      </a>
      <xf:if is="$position"><meta itemprop="position" content="{$position}" /></xf:if>
   </li>
</xf:macro>
It could also be related to an add-on, somehow.

Interestingly, I note that the site I mentioned seems to have modified HTML output - it looks like the HTML is minified. Worth checking to see if that is stripping things out unexpectedly.
 

Rivmedia

Member
Yes my first thought was our minification addon, but just switched to default theme on an affected site and the position is certainly there on the default theme even with all addons enabled so we must have the page_container not merged correctly or something.

Will go through the above a little later this afternoon, it's affecting a few of our themes so its obviously something we've done :)

Thanks for pointing it out Chris :)
 

Rivmedia

Member
Yes just tested, the entire bottom of the template was wrong. But weirdly only on a handful of our base themes, while others we're updated just fine.

Updated this entire block to fix :

Code:
<xf:macro name="breadcrumbs" arg-breadcrumbs="!" arg-navTree="!" arg-selectedNavEntry="{{ null }}" arg-variant="">
    <xf:if contentcheck="true">
        <ul class="p-breadcrumbs {{ $variant ? 'p-breadcrumbs--' . $variant : '' }}"
            itemscope itemtype="https://schema.org/BreadcrumbList">
        <xf:contentcheck>
            <xf:set var="$position" value="{{ 0 }}" />
            <xf:set var="$rootBreadcrumb" value="{$navTree.{$xf.options.rootBreadcrumb}}" />
            <xf:if is="$rootBreadcrumb AND $rootBreadcrumb.href != $xf.uri">
                <xf:set var="$position" value="{{ $position + 1 }}" />
                <xf:macro name="crumb"
                    arg-position="{$position}"
                    arg-href="{$rootBreadcrumb.href}"
                    arg-value="{$rootBreadcrumb.title}" />
            </xf:if>
            <xf:if is="$selectedNavEntry && $selectedNavEntry.href && $selectedNavEntry.href != $xf.uri && $selectedNavEntry.href != $rootBreadcrumb.href">
                <xf:set var="$position" value="{{ $position + 1 }}" />
                <xf:macro name="crumb"
                    arg-position="{$position}"
                    arg-href="{$selectedNavEntry.href}"
                    arg-value="{$selectedNavEntry.title}" />
            </xf:if>
            <xf:foreach loop="$breadcrumbs" value="$breadcrumb" if="$breadcrumb.href != $xf.uri">
                <xf:set var="$position" value="{{ $position + 1 }}" />
                <xf:macro name="crumb"
                    arg-position="{$position}"
                    arg-href="{$breadcrumb.href}"
                    arg-value="{$breadcrumb.value}" />
            </xf:foreach>
        </xf:contentcheck>
        </ul>
    </xf:if>
</xf:macro>
<xf:macro name="crumb" arg-href="!" arg-value="!" arg-position="{{ 0 }}">
    <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
        <a href="{$href}" itemprop="item">
            <span itemprop="name">{$value}</span>
        </a>
        <xf:if is="$position"><meta itemprop="position" content="{$position}" /></xf:if>
    </li>
</xf:macro>
But thanks again, should have checked out templates first before posting :)
 

Chris D

XenForo developer
Staff member
According to the Structured Data Testing Tool it is this:

1568992143187.png

Your "Home" icon breadcrumb doesn't have the name metadata. I'm fairly sure that might be an issue with your style as, by default, the home breadcrumb is made up of text and it includes the name metadata.
 

mikez006

Member
I'm getting both errors listed above plus a 3rd.

Error Either "name" or "item.name" should be specified
Error Missing field "position"
Error Missing field "item"

I'm still on 2.0.10. Are these fields included in this version?
 

Chris D

XenForo developer
Staff member
The causes are likely similar - outdated or poorly merged templates, an issue with the style, or an older version where those fields aren’t present but have since been added.

The only issue I acknowledge as being a bug is the position one though I thought it was fixed in a much earlier version of 2.0 so, again, it may be a style or template issue for you to investigate.

EDIT: Just had a closer look. Appears as though it was fixed in 2.0.10 so you should have received those changes. Again, likely a poorly merged template or outdated style.
 

brunoa

Member
Also received the same warning from Google today.

Missing field "position"
First detected: 9/18/19
Status: Error

Page_container for all my templates look exactly like the ones posted here. My forum URL: https://forum.outerspace.com.br/

<xf:macro name="crumb" arg-href="!" arg-value="!" arg-position="{{ 0 }}">
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<a href="{$href}" itemprop="item">
<span itemprop="name">{$value}</span>
</a>
<xf:if is="$position"><meta itemprop="position" content="{$position}" /></xf:if>
</li>
</xf:macro>
 

Chris D

XenForo developer
Staff member
Is Google reporting any specific URLs that are affected?

Also received the same warning from Google today.

Missing field "position"
First detected: 9/18/19
Status: Error

Page_container for all my templates look exactly like the ones posted here. My forum URL: https://forum.outerspace.com.br/

<xf:macro name="crumb" arg-href="!" arg-value="!" arg-position="{{ 0 }}">
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<a href="{$href}" itemprop="item">
<span itemprop="name">{$value}</span>
</a>
<xf:if is="$position"><meta itemprop="position" content="{$position}" /></xf:if>
</li>
</xf:macro>
Can't see any issues on your forum list or when viewing threads.

Google sent me this notification also :) following thread
Again, would need more information.

You can all use the Google Structured Data Testing tool if you have specific URLs that have errors:

 

Nirjonadda

Well-known member
I am also getting this email from Google. So I am going to ask @Ehren if he need updates Uniform style for support Xenforo 2.1.4 templates change and merged templates correctly?
 

Chris D

XenForo developer
Staff member
Is Google reporting any specific URLs that are affected? Thread URLs, for example?

Again, on your site, I can't see any issue.
 

brunoa

Member
Google reported 18 affected URLs for me (insignificant number, as we have close to 500k topics). Example:


URL inspection returned these errors:
 

Attachments

brunoa

Member
I see. Could be a mistake from Google. I've seen they report false errors in other occasions, but this one is new and looks like everyone received the same report today. Will be following the discussion here in case anyone find something. Thanks!
 

Ehren

Well-known member
I am also getting this email from Google. So I am going to ask @Ehren if he need updates Uniform style for support Xenforo 2.1.4 templates change and merged templates correctly?
All of my themes are working correctly with XenForo 2.1.4. I just checked your site and the breadcrumb code seems correct to me.. What URL's are being reported?
 

Nirjonadda

Well-known member
All of my themes are working correctly with XenForo 2.1.4. I just checked your site and the breadcrumb code seems correct to me.. What URL's are being reported?
ScreenShot01222.png

This URL https://mysite.com/forums/bollywood-movies.86/page-3?order=title&direction=asc
 
Top