How To Modify WP SEO Breadcrumbs For Schema.org

How To Modify WP SEO Breadcrumbs For Schema.org

A day ago, Ian Anderson Gray from iag.me opened this new thread in the Github repository for Yoast’s WordPress SEO plugin. He surely isn’t the only one thinking about using Schema.org markup in WordPress (I do too!), so if you are also interested, you should join the discussion. In this article I will not tell you the great unique amazing solution for this. BUT – I will show you how to modify the WordPress SEO plugin (using filters only) so that the plugin’s breadcrumbs will be using valid Schema.org markup instead of the old RDFa markup.

I personally think that Schema.org should be handled by WordPress themes because it will pretty much integrate with everything on the website (it should so that Google gets as much information as possible!). So while a plugin for this might help, I’d prefer to see themes that fully feature Schema.org markup. For this reason, I just developed a way to modify the breadcrumbs from Yoast’s WordPress SEO plugin. Adding the class below will do all the changes. I just wrote this, and I don’t have too much time right now, so I won’t describe everything in there. But if you are a coder, that should not be too hard to understand. So here is my class which will replace the RDFa markup with valid Schema.org markup that is correctly parsed by Google.

You can find and download the current version of the class on Github.

All you need to do is include this class in your theme and then instantiate it. The readme file in the Github repository tells you how to do so.

And that’s it!

If you have any questions about the usage of this class or if you find any mistakes or bugs, please comment or email me, thank you in advance!

10 thoughts on “How To Modify WP SEO Breadcrumbs For Schema.org

    • Posted on
    • AuthorWillemSiebe

    Hi Felix,

    Why use Schema.org when Yoast is telling us Google still prefers the old format:

    QUOTE: Google itself still states it prefers RDFa for breadcrumbs

    You didn’t reply on Yoast @Github when he told us that, but he also posted a link to support his statement. However, I read that document, but that\’s to technical for me at the moment and I couldn’t find anything what was telling us not to use schema.org. However, I would like your opinion about it.

    Thanks.

    Willem-Siebe

    Hello Willem,

    To be honest, I was a little busy in recent weeks, sorry…

    I also had some problems to understand everything in that mail, but like you, I didn\’t see a point where they were telling not to use Schema.org. I just answered at Github, so maybe Yoast will explain this to me.

    My personal opinion is this, I think using Schema.org all over would just be coherent. Google recommends using it, so why not use it for breadcrumbs aswell? It certainly works (if you do it right) like I tested… But maybe let\’s wait for Yoast\’s answer on that.

    Thanks for your comment, I hope this gets solved soon!

    Felix

    • Posted on
    • AuthorWillemSiebe

    Hi Felix,

    Thanks for your reply. I almost wanted to reply there as well, but I tested first if your Rich Schema markup really works. You are right that it doens’t give any errors, but if you look in the Rich Snippet testing tool, you can not see a breadcrumb on your page, and with a page from Yoast.com it does. Please check:

    http://www.google.nl/webmasters/tools/richsnippets?q=http%3A%2F%2Fblog.leaves-and-love.net%2Fhow-to-modify-wp-seo-breadcrumbs-for-schema-org%2F
    (your page, shows normal URL)

    http://www.google.nl/webmasters/tools/richsnippets?q=http%3A%2F%2Fyoast.com%2Ftests-not-scientific%2F (yoast.com page, with breadcrumb)

    What do you think of this?

    Kind regards,

    Willem-Siebe

    Okay, that’s a good point. It really seems Google does prefer RDFa for breadcrumbs…

    Thanks for this information! I think we’ll have to see how everything evolves. So Yoast is probably right, nonetheless I hope Google will soon add the same kind of support to Schema.org markup.

    I guess for now we should really stick with RDFa, but I would certainly like to use Schema all over instead of mixing up different types of markup. I will try to stay up-to-date on this topic.

    Thanks again!
    Felix

    • Posted on
    • AuthorWillemSiebe

    Yes, let’s stay in touch! I +1 your tweet to Matt Cutts.

    • Posted on
    • AuthorWillemSiebe

    Do you think we can overwrite the HTML output for Yoast breadcrumbs without losing this when we update the plugin? I’m curious what you think of the in my opinion ‘no so good’ HTML.

    Sorry, but I’m currently not really getting what you mean. Could you maybe elaborate on this? So the Yoast plugin currently uses span elements for the breadcrumbs right? What exactly do you think it should look like?

    As of modifying the plugin, I’m sure there is a way without losing changes since there are enough filters to modify the breadcrumb code (like in my SchemaOrg_Breadcrumbs class in the above article).

    • Posted on
    • AuthorWillemSiebe

    Ok Felix, that’s a good thing. I\’m not that good in coding in into the plugin, but I do know what I want for ‘HTML’. And you are right, now Yoast uses span elements, and that is not the way I want it. Also, the brackets “>” or what ever you choose are coded in the HTML, but should actually be CSS (using “:before” for example.

    So here you can find an improved version of HTML for the breadcrumbs:

    http://www.w3.org/html/wg/drafts/html/master/common-idioms.html#rel-up

    They discuss the change here:

    https://www.w3.org/Bugs/Public/show_bug.cgi?id=22739

    I would do the HTML slightly different, I\’m going to send an e-mail to you how it should be (your business emailadress). Let me know you thoughts!

    Kind regards,

    Willem

    • Posted on
    • AuthorBill Ukers

    Hello Felix,

    I think you should seriously revisit what you present in this post in case some other people follow your route. I just checked this very page in Google and it returned 12 errors in your page, including all the markups in breadcrumbs. I am looking for a way to do it correctly and came upon your page to have seen it. Good luck.

    Hello Bill,

    thanks a lot for telling me this. I checked it and I found out that the Schema.org specification for breadcrumbs changed. So I updated the class to reflect these changes. It is correctly parsed now.

    The other errors you encountered in my page are results of the Disqus comment system using microdata markup incorrectly. I found a quick workaround for this, but it’s not a real solution. The problem is that I cannot edit the Disqus output, that sucks.

    Thanks again!

Leave a Reply

Your email address will not be published. Required fields are marked *