• Hey guys! Could you help me to find it out. Swearing at a chain of crumbs, maybe I lost sight of something.

    Missing field “item” – error in Google webmaster

    Swearing at this piece of code:

    <li itemprop=”itemListElement” itemscope itemtype=”https://schema.org/ListItem&#8221; class=”trail-item trail-begin”><span itemprop=”name”>Main</span><meta itemprop=”position” content=”1″ />

    The code in the template is:

    // Open the unordered list.
    $breadcrumb .= ‘<ul class=”trail-items” itemscope itemtype=”https://schema.org/BreadcrumbList”>&#8217;;

    // Add the number of items and item list order schema.
    $breadcrumb .= sprintf( ‘<meta name=”numberOfItems” content=”%d” />’, absint( $item_count ) );
    $breadcrumb .= ‘<meta name=”itemListOrder” content=”Ascending” />’;

    // Loop through the items and add them to the list.
    foreach ( $this->items as $item ) {

    // Iterate the item position.
    ++$item_position;

    // Check if the item is linked.
    preg_match( ‘/(<a.*?>)(.*?)(<\/a>)/i’, $item, $matches );

    // Wrap the item text with appropriate itemprop.
    $item = !empty( $matches ) ? sprintf( ‘%s<span itemprop=”name”>%s</span>%s’, $matches[1], $matches[2], $matches[3] ) : sprintf( ‘<span itemprop=”name”>%s</span>’, $item );

    // Add list item classes.
    $item_class = ‘trail-item’;

    if ( 1 === $item_position && 1 < $item_count )
    $item_class .= ‘ trail-begin’;

    elseif ( $item_count === $item_position )
    $item_class .= ‘ trail-end’;

    // Create list item attributes.
    $attributes = ‘itemprop=”itemListElement” itemscope itemtype=”https://schema.org/ListItem&#8221; class=”‘ . $item_class . ‘”‘;

    // Build the meta position HTML.
    $meta = sprintf( ‘<meta itemprop=”position” content=”%s” />’, absint( $item_position ) );

    // Build the list item.
    $breadcrumb .= sprintf( ‘<li %s>%s%s‘, $attributes, $item, $meta );
    }

    // Close the unordered list.
    $breadcrumb .= ‘‘;

    Help me to find it out where to fix something?

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

Viewing 1 replies (of 1 total)
  • Plugin Author John Havlik

    (@mtekk)

    Your problem is likely due to having BeadcrumbList markup for the current item but not having a link/URL in the breadcrumb. However, please note this may not be the correct forum section for your question. This forum section is for providing support for users of Breadcrumb NavXT. As far as I can tell, you are not using Breadcrumb NavXT on the site in question (or in the code in your topic message implies you are using your own breadcrumb trail solution).

Viewing 1 replies (of 1 total)
  • The topic ‘Missing field “item” – error in Google webmaster’ is closed to new replies.