Jump to content
Дизайн и модификация Invision Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
AlexMistix

Отсутствует поле "item" - ошибка в Гугл вебмастере

Recommended Posts

Всем привет, может поможет кто разобраться. Ругается на цепочку крошек, может я упустил что-то из виду.

Ругается вот на этот кусок кода:

<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem" class="trail-item trail-begin"><a href="https://site.ru" rel="home"><span itemprop="name">Главная</span></a><meta itemprop="position" content="1" /></li>


Код в шаблоне такой:

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

// 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="http://schema.org/ListItem" 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</li>', $attributes, $item, $meta );
    }

// Close the unordered list.
$breadcrumb .= '</ul>';


Помогите разобраться где что поправить?

Edited by Lesovsky
Используйте специальный бб-код для вставки фрагментов кода!

Share this post


Link to post

https://developers.google.com/search/docs/data-types/breadcrumb

      <li itemprop="itemListElement" itemscope
          itemtype="https://schema.org/ListItem">
        <a itemprop="item" href="https://example.com/books">
            <span itemprop="name">Books</span></a>
        <meta itemprop="position" content="1" />
      </li>

У ссылки есть атрибут itemprop со значением item

Share this post


Link to post
8 часов назад, newbie сказал:

https://developers.google.com/search/docs/data-types/breadcrumb


      <li itemprop="itemListElement" itemscope
          itemtype="https://schema.org/ListItem">
        <a itemprop="item" href="https://example.com/books">
            <span itemprop="name">Books</span></a>
        <meta itemprop="position" content="1" />
      </li>

У ссылки есть атрибут itemprop со значением item

поправил и добавил itemprop="item", но все равно пишет что ошибка

image.thumb.png.a0073969dd3564ca87b5c77e19b924db.png

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...