Google Search Console errors

General questions about CMSimple
bca
Posts: 293
Joined: Tue Sep 15, 2009 4:49 pm

Google Search Console errors

Post by bca » Fri Sep 20, 2019 12:46 pm

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

designfjord
Posts: 68
Joined: Fri Apr 16, 2010 4:19 pm
Location: Germany/Franconia

Re: Google Search Console errors

Post by designfjord » Sun Sep 22, 2019 7:10 pm

"me too" !
The "error" is function locator.

Is there a solution?

Thanks in advance
Jochen
leberecht.net | keep it simple, or fail

lck
Posts: 2963
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: Google Search Console errors

Post by lck » Mon Sep 23, 2019 12:07 pm

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.
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

bca
Posts: 293
Joined: Tue Sep 15, 2009 4:49 pm

Re: Google Search Console errors

Post by bca » Tue Sep 24, 2019 2:26 pm

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

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Google Search Console errors

Post by cmb » Wed Sep 25, 2019 9:50 pm

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).
Christoph M. Becker – Plugins for CMSimple_XH

bca
Posts: 293
Joined: Tue Sep 15, 2009 4:49 pm

Re: Google Search Console errors

Post by bca » Thu Oct 03, 2019 9:04 am

That worked thanks

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

Brett

olape
Posts: 2731
Joined: Fri Mar 13, 2015 8:47 am
Contact:

Re: Google Search Console errors

Post by olape » Sun Nov 03, 2019 12:40 pm

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
Last edited by olape on Sun Nov 03, 2019 6:20 pm, edited 1 time in total.
Gruß Olaf, Plugins for CMSimple_XH

Ich habe schon lange den Verdacht, dass so viele so eifrig auf Gender, Trans und Queer machen:
Weil sie für das Fachliche ganz einfach zu doof sind.

olape
Posts: 2731
Joined: Fri Mar 13, 2015 8:47 am
Contact:

Re: Google Search Console errors

Post by olape » Sun Nov 03, 2019 1:59 pm

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.
Gruß Olaf, Plugins for CMSimple_XH

Ich habe schon lange den Verdacht, dass so viele so eifrig auf Gender, Trans und Queer machen:
Weil sie für das Fachliche ganz einfach zu doof sind.

olape
Posts: 2731
Joined: Fri Mar 13, 2015 8:47 am
Contact:

Re: Google Search Console errors

Post by olape » Sun Nov 03, 2019 2:10 pm

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;
}
Gruß Olaf, Plugins for CMSimple_XH

Ich habe schon lange den Verdacht, dass so viele so eifrig auf Gender, Trans und Queer machen:
Weil sie für das Fachliche ganz einfach zu doof sind.

olape
Posts: 2731
Joined: Fri Mar 13, 2015 8:47 am
Contact:

Re: Google Search Console errors

Post by olape » Mon Dec 09, 2019 1:56 pm

olape wrote:
Sun Nov 03, 2019 2:10 pm
This is how it works correctly together with OGra_XH.
and the last element is not a link

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>';
        if (isset($url) && $i < $last) {
			$html .= '<a itemprop="item" href="' . $url . '">'
                . $inner . '</a>';
        } else {
			$html .= $inner;
        }
		$html .= '<meta itemprop="position" content="'. ($i + 1) . '"></span>';
    }
    $html .= '</span>';
    return $html;
}
Gruß Olaf, Plugins for CMSimple_XH

Ich habe schon lange den Verdacht, dass so viele so eifrig auf Gender, Trans und Queer machen:
Weil sie für das Fachliche ganz einfach zu doof sind.

Post Reply