Support » Plugin: Yoast SEO » Error with breadcrumbs structured data

  • Resolved Matthew

    (@matthew0utin0hb)


    Hi,

    Ever since the google announcements of including breadcrumbs within the sreach console, we have had errors related to the Yoast SEO plugin on our sites. I have checked plugin compatibility and everything seems fine. I have also disabled other plugins but the problem is still there when the Yoast SEO plugin is enabled.

    Breadcrumb structured data error: “One of name or item.name must be provided.”.

    Could someone give me an update when this issue will be fixed.

    Also replied to this ticket about the issue: https://wordpress.org/support/topic/breadcrumbs-missing-field-id-error-in-google-search-sonsole/

    Many thanks,

    Matt

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support amboutwe

    (@amboutwe)

    This appears to be related to the second breadcrumb item which doesn’t seem to exist. Have you made any adjustments to the breadcrumbs? If not, can you provide a screenshot of the global breadcrumb settings, your permalink settings and the settings of the advanced tab under the Yoast metabox for the example URL?

    Matthew

    (@matthew0utin0hb)

    Hi @amboutwe

    Thanks for your reply, I haven’t made any adjustments to the breadcrumb config within Yoast SEO. I’ll post some images below of the setup.

    Global breadcrumb settings 1

    Global breadcrumb settings 2

    Permalink settings

    Yoast metabox post settings

    • This reply was modified 1 year, 1 month ago by Matthew.
    Plugin Support amboutwe

    (@amboutwe)

    Something has added a third breadcrumb item. Using the same settings in a test environment, I was unable to reproduce a third breadcrumb item. Seems that something attempts to break the second breadcrumb into two parts.

    Is this a standard post or a custom post (like case studies, resource, etc)?
    Does the issue occur with only Yoast SEO on a default theme? If not, what is the minimum setup (plugin/theme combination) required to reproduce the issue consistently?

    Your site

        {
            "@type":"BreadcrumbList",
            "@id":"https://www.example.co.uk/graham-post/#breadcrumb",
            "itemListElement":[ {
                "@type":"ListItem",
                "position":1,
                "item": {
                    "@type": "WebPage", "@id": "https://www.example.co.uk/", "url": "https://www.example.co.uk/", "name": "Home"
                }
            }
            ,
            {
                "@type":"ListItem",
                "position":2,
                "item": {
                    "@type": "WebPage", "@id": "Graham Post Title | Press release", "url": "Graham Post Title | Press release", "name": ""
                }
            }
            ,
            {
                "@type":"ListItem",
                "position":3,
                "item": {
                    "@type": "WebPage", "@id": "https://www.example.co.uk/graham-post/", "url": "https://www.example.co.uk/graham-post/", "name": "Graham Post Title"
                }
            }
            ]
        }

    Test site with same breadcrumb settings

        {
            "@type":"BreadcrumbList",
            "@id":"http://breadcrumbs.test/hello-world/#breadcrumb",
            "itemListElement":[ {
                "@type":"ListItem",
                "position":1,
                "item": {
                    "@type": "WebPage", "@id": "http://breadcrumbs.test/", "url": "http://breadcrumbs.test/", "name": "Home"
                }
            }
            ,
            {
                "@type":"ListItem",
                "position":2,
                "item": {
                    "@type": "WebPage", "@id": "http://breadcrumbs.test/hello-world/", "url": "http://breadcrumbs.test/hello-world/", "name": "Custom BC title"
                }
            }
            ]
        }
    • This reply was modified 1 year ago by amboutwe. Reason: Fix code ticks
    Matthew

    (@matthew0utin0hb)

    Hi @amboutwe

    It is a standard blog post, we do have case studies, but they are working fine pulling in the correct information when looking at the Breadcrumb List’s.

    We currently only use Yoast SEO code to create the breadcrumbs on our websites:

    
    if ( function_exists('yoast_breadcrumb') )
    {
    yoast_breadcrumb('<div class="breadcrumb container">','</div>');
    }
    

    I think it’s due to our theme the reason we have 3 items showing this is on all our sites, only two of our sites so far have the issue with a missing name. Also, I couldn’t pinpoint what’s populating the missing name, I did use the health check plugin to check but as soon as I switched the theme over, it errored and took down the site… So, won’t be trying that option.

    I then had a look at the Yoast SEO plugin code and noticed that there is a line of code within “wordpress-seo –> frontend –> schema –> class-schema-breadcrumb.php” That contains code stating if name is empty then change URL to title.

    
    if ( empty( $breadcrumb['text'] ) ) {
    	$breadcrumb['url'] = $this->context->title;
    }
    

    This seemed slightly odd changing the $breadcrumb[‘url’] = title, when you’re looking to see if name is empty, don’t know if this is a bug/ typo within the plugin code?

    To me, to stop the error this should have been $breadcrumb[‘text’] = “Some Default Value”; This also would have stopped the errors if the name was empty and the codes there, it’s just odd it wasn’t used?

    e.g. example code plugin fix:

    
    if ( empty( $breadcrumb['text'] ) ) {
    	$breadcrumb['url'] = $this->context->title;
            $breadcrumb['text'] = "Some Default Value";
    }
    

    Anyway seeing that most of the code is there, I have added my own code to the plugin to fix the issue, I know this isn’t ideal as every time we update the plugin, we will need to add in the custom hard codded code to the plugin but at least this fixes the issue.

    Hard codded code added to class-schema-breadcrumb.php:

    
    if ( empty( $breadcrumb['text'] ) ) {
    	$breadcrumb['url'] = $this->context->title;
    	if (get_post_type() === 'post') {
    		$breadcrumb['url'] = "https://www.hiltonbairdaudit.co.uk/blog/";
      		$breadcrumb['text'] = "Blog";
    		}
    	}
    

    Fixed output:

    
    {
        "@type":"BreadcrumbList",
        "@id":"https://www.hiltonbairdaudit.co.uk/alan-baird-named-lecturer-of-the-year-again/#breadcrumb",
        "itemListElement":[ {
            "@type":"ListItem",
            "position":1,
            "item": {
                "@type": "WebPage", "@id": "https://www.hiltonbairdaudit.co.uk/", "url": "https://www.hiltonbairdaudit.co.uk/", "name": "Home"
            }
        }
        ,
        {
            "@type":"ListItem",
            "position":2,
            "item": {
                "@type": "WebPage", "@id": "https://www.hiltonbairdaudit.co.uk/blog/", "url": "https://www.hiltonbairdaudit.co.uk/blog/", "name": "Blog"
            }
        }
        ,
        {
            "@type":"ListItem",
            "position":3,
            "item": {
                "@type": "WebPage", "@id": "https://www.hiltonbairdaudit.co.uk/alan-baird-named-lecturer-of-the-year-again/", "url": "https://www.hiltonbairdaudit.co.uk/alan-baird-named-lecturer-of-the-year-again/", "name": "Alan Baird named Lecturer of the Year again"
            }
        }
        ]
    }
    
    • This reply was modified 1 year ago by Matthew.
    • This reply was modified 1 year ago by Matthew.
    • This reply was modified 1 year ago by Matthew.
    • This reply was modified 1 year ago by Matthew.
    • This reply was modified 1 year ago by Matthew.
    Plugin Support Pcosta88

    (@pcosta88)

    Hi,

    As we are unable to reproduce the issue and do not have access to theme we are not sure if this is a bug or something specific to your site set-up.

    We suggest creating an issue report for our developers on GitHub here. You may need an account to post. If you are not sure how to create an issue report, this guide explains more: https://kb.yoast.com/kb/how-to-write-a-good-bug-report/.

    Matthew

    (@matthew0utin0hb)

    Hi @pcosta88

    Thanks for your message. Thats understandable i’ll create a feature request to fix the issue on GitHub, I’ll reference this ticket.

    Thanks

    Plugin Support amboutwe

    (@amboutwe)

    Thank you @matthew0utin0hb for opening an issue. Feature requests are investigated in GitHub so this topic was closed in favor of the open issue. Please leave a comment or subscribe to the GitHub report to get updates on the issue.

    https://github.com/Yoast/wordpress-seo/issues/13616

    Matthew

    (@matthew0utin0hb)

    Thanks @amboutwe, Will do that’s my open Github ticket anyway so I will get the updates.

    I’ll close this post.

    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Error with breadcrumbs structured data’ is closed to new replies.