Перейти к публикации
View in the app

A better way to browse. Learn more.

Дизайн и модификация Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Опубликовано:

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

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

<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>';


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

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

Рекомендованные сообщения

Опубликовано:

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

Опубликовано:
  • Автор
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

Создайте аккаунт или войдите в него для комментирования

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.