Page 1 of 1

Google Search Console errors

Posted: Fri Sep 20, 2019 12:46 pm
by bca
In the last couple of days I have been receiving Search Console error reports on all my CMSimple sites( except 1)
It says "Fix Breadcrumbs Markup"
I dont receive the error on a site that is at 1.6.7 but on all sites with 1.7.2

I have looked at the generated locator code in the Google Structured Data testing Tool and it throws up errors.
position: A value for the position field is required
and
item: A value for the item field is required

Looking at the code it seems there is a </a> in the wrong place (moving it fixes the position error)
and on the last item in a list the <a property="item" typeof="WebPage" href="XXX"> is missing altogether.

I assume the error is in function locator()

B

Re: Google Search Console errors

Posted: Sun Sep 22, 2019 7:10 pm
by designfjord
"me too" !
The "error" is function locator.

Is there a solution?

Thanks in advance
Jochen

Re: Google Search Console errors

Posted: Mon Sep 23, 2019 12:07 pm
by lck
bca wrote:
Fri Sep 20, 2019 12:46 pm
Looking at the code it seems there is a </a> in the wrong place (moving it fixes the position error)
and on the last item in a list the <a property="item" typeof="WebPage" href="XXX"> is missing altogether.

I assume the error is in function locator()
This seems to be the case in tplfuncs.php (Example-Page of the mentioned errors).

The </a> tag should be moved and inserted before <meta property="position" content="...>.
And also the last entry in the breadcrumb navigation must be linked to fix all errors.

Re: Google Search Console errors

Posted: Tue Sep 24, 2019 2:26 pm
by bca
After a bit of experimentation this seems to work.I hope its valid

Code: Select all

function locator()
{
    $breadcrumbs = XH_getLocatorModel();
    $last = count($breadcrumbs);
    $html = '<span vocab="http://schema.org/" typeof="BreadcrumbList">';
    foreach ($breadcrumbs as $i => $breadcrumb) {
        list($title, $url) = $breadcrumb;
        if ($i > 0) {
            $html .= ' &gt; ';
        }
        $html .= '<span property="itemListElement" typeof="ListItem">';
        $inner = '<span property="name">' . $title
            . '</span></a><meta property="position" content="'. ($i + 1) . '">';
        if (isset($url) && $i < $last) {
            $html .= '<a property="item" typeof="WebPage" href="' . $url . '">'
                . $inner . '</a>';
        } else {
            $html .= $inner;
        }
        $html .= '</span>';
    }
    $html .= '</span>';
    return $html;
}
Ive put the <\a> in at line 11 and taken out the -1 at line 2. You get a link on every breadcrumb including the last one.
There is some code in there which doesnt need to be there but not great at coding so not sure what does what. :lol: :cry:

B

Re: Google Search Console errors

Posted: Wed Sep 25, 2019 9:50 pm
by cmb
bca wrote:
Fri Sep 20, 2019 12:46 pm
Looking at the code it seems there is a </a> in the wrong place (moving it fixes the position error)
Indeed. For some reason I missed that `position` is meant to be a sibling of `item`, but not a child of it.
bca wrote:
Fri Sep 20, 2019 12:46 pm
and on the last item in a list the <a property="item" typeof="WebPage" href="XXX"> is missing altogether.
Well, actually linking to the page you're already on is something we didn't intend to do. Of course, this could be changed, but it seems to me that Google might not need an actual link, but a <span> would also do.

So tentatively, I suggest this patch. The testing tool appears to be satisfied with that.

PS: fun stuff (or maybe not so funny – could have had already been fixed).

Re: Google Search Console errors

Posted: Thu Oct 03, 2019 9:04 am
by bca
That worked thanks

Just heard from google that all is well. :roll:

Brett

Re: Google Search Console errors

Posted: Sun Nov 03, 2019 12:40 pm
by olape
With the code changes of GitHub there are more problems than before.
However almost exclusively in connection with OGra_XH and additionally with the specification of <link rel="alternate" hreflang.

Where is the error now? Breadcrump or OGra_XH?

before:

https://olaf.penschke.net/?CMSimple_XH/ ... -Textdatei

Brand
0 FEHLER
0 WARNUNGEN
1 ELEMENT

WebPage
0 FEHLER
0 WARNUNGEN
1 ELEMENT

SoftwareApplication
0 FEHLER
1 WARNUNG
1 ELEMENT

BreadcrumbList
4 FEHLER
0 WARNUNGEN
1 ELEMENT

after:

Brand
0 FEHLER
0 WARNUNGEN
1 ELEMENT

WebPage
0 FEHLER
0 WARNUNGEN
1 ELEMENT

SoftwareApplication
0 FEHLER
1 WARNUNG
1 ELEMENT

BreadcrumbList
15 FEHLER
0 WARNUNGEN
1 ELEMENT


http://ogp.me/ns#type

og:article (Die Eigenschaft http://ogp.me/ns#type wird von Google nicht als Objekt des Typs WebPage erkannt.)
cancelhttp://ogp.me/ns#locale

de-DE (Die Eigenschaft http://ogp.me/ns#locale wird von Google nicht als Objekt des Typs WebPage erkannt.)
cancelhttp://ogp.me/ns#title

CMSimple_XH | Plugin | Remotecontent_XH | Beispiel Textdatei (Die Eigenschaft http://ogp.me/ns#title wird von Google nicht als Objekt des Typs WebPage erkannt.)
cancelhttp://ogp.me/ns#site_name

CMSimple_XH Plugins, Kawasaki Vulcan (Die Eigenschaft http://ogp.me/ns#site_name wird von Google nicht als Objekt des Typs WebPage erkannt.)
cancelhttp://ogp.me/ns#url

https://olaf.penschke.net/?CMSimple_XH/ ... -Textdatei (Die Eigenschaft http://ogp.me/ns#url wird von Google nicht als Objekt des Typs WebPage erkannt.)
cancelhttp://ogp.me/ns#updated_time

2018-03-07T15:59:49+01:00 (Die Eigenschaft http://ogp.me/ns#updated_time wird von Google nicht als Objekt des Typs WebPage erkannt.)
cancelhttp://ogp.me/ns#image

https://olaf.penschke.net/userfiles/ima ... ent_xh.jpg (Die Eigenschaft http://ogp.me/ns#image wird von Google nicht als Objekt des Typs WebPage erkannt.)
cancelhttp://dev.twitter.com/docs/cards#card

twitter:summary (Die Eigenschaft http://dev.twitter.com/docs/cards#card wird von Google nicht als Objekt des Typs WebPage erkannt.)
cancelhttp://dev.twitter.com/docs/cards#title

CMSimple_XH | Plugin | Remotecontent_XH | Beispiel Textdatei (Die Eigenschaft http://dev.twitter.com/docs/cards#title wird von Google nicht als Objekt des Typs WebPage erkannt.)
cancelhttp://dev.twitter.com/docs/cards#url

https://olaf.penschke.net/?CMSimple_XH/ ... -Textdatei (Die Eigenschaft http://dev.twitter.com/docs/cards#url wird von Google nicht als Objekt des Typs WebPage erkannt.)
cancelhttp://dev.twitter.com/docs/cards#image

https://olaf.penschke.net/userfiles/ima ... ent_xh.jpg (Die Eigenschaft http://dev.twitter.com/docs/cards#image wird von Google nicht als Objekt des Typs WebPage erkannt.)
cancelhttp://dev.twitter.com/docs/cards#site

@Olaf_Penschke (Die Eigenschaft http://dev.twitter.com/docs/cards#site wird von Google nicht als Objekt des Typs WebPage erkannt.)
name

Beispiel-Textdatei
cancelhttp://www.w3.org/1999/xhtml/vocab#alternate

Die Eigenschaft http://www.w3.org/1999/xhtml/vocab#alternate wird von Google nicht als Objekt des Typs WebPage erkannt.
@type

Nicht definierter Typ
cancelhttp://www.w3.org/1999/xhtml/vocab#alternate

Die Eigenschaft http://www.w3.org/1999/xhtml/vocab#alternate wird von Google nicht als Objekt des Typs WebPage erkannt.
@type

WebPage
cancelhttp://www.w3.org/1999/xhtml/vocab#alternate

Die Eigenschaft http://www.w3.org/1999/xhtml/vocab#alternate wird von Google nicht als Objekt des Typs WebPage erkannt.
@type

WebPage

Re: Google Search Console errors

Posted: Sun Nov 03, 2019 1:59 pm
by olape
with the switch from RDFa to Microdata it looks better.

Brand
0 FEHLER
0 WARNUNGEN
1 ELEMENT

WebPage
0 FEHLER
0 WARNUNGEN
1 ELEMENT

SoftwareApplication
0 FEHLER
1 WARNUNG
1 ELEMENT

BreadcrumbList
1 FEHLER
0 WARNUNGEN
1 ELEMENT

The last Element is span, not a. This makes the mistake

position 5
item

@type

Thing
@id

Der Wert für id muss eine gültige URL sein.

Re: Google Search Console errors

Posted: Sun Nov 03, 2019 2:10 pm
by olape
This is how it works correctly together with OGra_XH.

Code: Select all

function locator()
{
    $breadcrumbs = XH_getLocatorModel();
    $last = count($breadcrumbs) - 1;
	$html = '<span itemscope itemtype="http://schema.org/BreadcrumbList">';
    foreach ($breadcrumbs as $i => $breadcrumb) {
        list($title, $url) = $breadcrumb;
        if ($i > 0) {
            $html .= ' &gt; ';
        }
		$html .= '<span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">';
		$inner = '<span itemprop="name">' . $title
			. '</span>';
			$html .= '<a itemprop="item" href="' . $url . '">'
                . $inner . '</a>';
		$html .= '<meta itemprop="position" content="'. ($i + 1) . '"></span>';
    }
    $html .= '</span>';
    return $html;
}