How to implement schema.org markup for a breadcrumb?

后端 未结 9 892
自闭症患者
自闭症患者 2020-12-12 17:45

There isn\'t much info about implementing a breadcrumb using schema.org markup. So far, I could get two official documents -- one showing this:

相关标签:
9条回答
  • 2020-12-12 18:10
       itemscope itemtype="...">
    

    Is invalid in an xhtml page.

    The correct syntax is:

       itemscope="itemscope" itemtype="...">
    
    0 讨论(0)
  • 2020-12-12 18:12

    This validates now in Google's Structured Data Testing Tool

    <nav role="navigation" class="breadcrumb" itemscope itemtype="http://schema.org/Breadcrumb">
        <ol itemscope itemtype="http://schema.org/BreadcrumbList">
          <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
            <a itemprop="item" href="/"><span itemprop="name">Home</span></a>
            <meta itemprop="position" content="1" />
          </li>
          <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
            <a itemprop="item" href="/about-us"><span itemprop="name">About Us</span></a>
            <meta itemprop="position" content="2" />
          </li>
        </ol>
    </nav>
    
    0 讨论(0)
  • 2020-12-12 18:14

    @IssaBERTHE's answer is correct. meh, need more rep to comment, For anyone using wordpress check out this plugin. You can tailor it to fit your needs and follow google standard. It has the positioning built in.

        Can Download here -> breadcrumb-trail plugin
    

    It does need a little correcting. The file we need to edit is breadcrumb-trail-master\inc\breadcrumbs.php

    You do need to edit line 213:

    $breadcrumb = sprintf('<%1$s role="navigation" aria-label="%2$s" class="breadcrumb-trail breadcrumbs" itemprop="breadcrumb">%3$s%4$s%5$s</%1$s>',
    

    We're removing the itemprop, so it should look like:

     $breadcrumb = sprintf('<%1$s role="navigation" aria-label="%2$s" class="breadcrumb-trail breadcrumbs">%3$s%4$s%5$s</%1$s>',
    

    Now scroll up and edit line 172:

     $breadcrumb .= '<ul class="trail-items" itemscope itemtype="http://schema.org/BreadcrumbList">';
    

    Add the itemprop here instead:

     $breadcrumb .= '<ul class="trail-items" itemprop="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList">';
    

    The author thought you had to break them up I guess. Now when checking, it should register correctly.

    0 讨论(0)
提交回复
热议问题