Пример разметки хлебных крошек по schema.org

<ul itemscope itemtype="https://schema.org/BreadcrumbList">
    <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
        <a href="/" title="Главная" itemprop="item">
            <span itemprop="name">Главная</span>
            <meta itemprop="position" content="0">
        </a>
    </li>
    <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
        <a href="/my-section/" title="Мой Раздел" itemprop="item">
            <span itemprop="name">Мой Раздел</span>
            <meta itemprop="position" content="1">
        </a>
    </li>
    <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
        <a href="/my-section/page/" title="Страница" itemprop="item">
            <span itemprop="name">Страница</span>
            <meta itemprop="position" content="2">
        </a>
    </li>
</ul>

itemscope - указывает поисковому боту, что на странице описывается определенный объект.

itemtype - указывает поисковому боту тип объекта.

itemtype="https://schema.org/BreadcrumbList" - указывает тип объекта как «хлебные крошки» и состоит из цепочки связанных веб-страниц.

itemprop="itemListElement" - указывает на отдельный пункту списка текущего объекта.

itemprop="item" - разметка ссылки.

itemprop="name" - название текущего элемента списка, название хлебной крошки.

meta itemprop="position" content="number" - определяет позицию элемента в навигационной цепочке.

Добавляем микроразметка хлебных крошек в Yii1

Создаем новый виджет хлебных крошек

Для начала создадим класс MyBreadcrumbs.php (app/protected/widgets/MyBreadcrumbs.php), который будет наследовать базовый класс хлебных крошек CBreadcrumbs, со следующим кодом:

<?php
Yii::import('zii.widgets.CBreadcrumbs');
class MyBreadcrumbs extends CBreadcrumbs {
    public function run() {
        if(empty($this->links)) {
            return;
        }
        $definedLinks = $this->links;
        echo CHtml::openTag($this->tagName, $this->htmlOptions)."\n";
        $links=array();
        if($this->homeLink === null) {
            $definedLinks = array(Yii::t('zii', 'Home') => Yii::app()->homeUrl) + $definedLinks;
        } else if($this->homeLink !== false) {
            $links[] = $this->homeLink;
        }
        $position = 1;
        foreach($definedLinks as $label=>$url) {
            if(is_string($label) || is_array($url)) {
                $links[] = strtr($this->activeLinkTemplate, array(
                    '{url}' => CHtml::normalizeUrl($url),
                    '{label}' => $this->encodeLabel ? CHtml::encode($label) : $label,
                    '{position}' => $position,
                ));
            } else {
                $endLink = str_replace('{position}', $position, $this->inactiveLinkTemplate);
                $links[] = str_replace('{label}', $this->encodeLabel ? CHtml::encode($url) : $url, $endLink);
            }
            $position++;
        }
        echo implode($this->separator,$links);
        echo CHtml::closeTag($this->tagName);
    }
}

Вызываем виджет хлебных крошек с микроразметкой

Теперь в месте где вызывается стандартный виджет хлебных крошек CBreadcrumbs (обычно это: app/themes/themeName/views/layouts/main.php) заменяем вызов стандартного виджета на наш:

<?php
$this->widget('application.widgets.MyBreadcrumbs', array(
    'links' => $this->breadcrumbs,
    'homeLink' => '<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a href="/" itemprop="item"><span itemprop="name">' . Yii::t('main', 'breadcrumbs.mainPage.text') . '</span></a><meta itemprop="position" content="0"></li>',
    'tagName' => 'ol',
    'separator' => ' ',
    'activeLinkTemplate' => '<li title="{label}" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a href="{url}" itemprop="item"><span itemprop="name">{label}</span></a><meta itemprop="position" content="{position}"></li>',
    'inactiveLinkTemplate' => '<li class="active" title="{label}" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><span itemprop="name" class="breadcrumb-current">{label}</span><meta itemprop="position" content="{position}"></li>',
    'htmlOptions' => array('class' => 'breadcrumb', 'itemscope itemtype' => 'https://schema.org/BreadcrumbList'),
    'encodeLabel' => false,
));

Заполняем массив хлебных крошек

В контроллере массив с хлебными крошками заполняется как и раньше:

$this->breadcrumbs = array(
    'Мой раздел' => array('/my-section'),
    $this->breadcrumbsTitle
);

Как проверить микроразметку на сайте?

Проверить правильность микроразметки на сайте можно с помощью инструмента от google: https://developers.google.com/search/docs/advanced...