Elite-Board tech support
https://forum.illusionweb.ru/

Микроразметка хлебных крошек
https://forum.illusionweb.ru/viewtopic.php?f=3&t=4811
Страница 1 из 2

Автор:  Михаил [ 03 ноя 2021, 14:44 ]
Заголовок сообщения:  Микроразметка хлебных крошек

Юра, привет! Помоги сделать нумерацию itemprop="position" content=""
Есть такая цепочка навигации на странице объявления/категории - Главная / Собаки / Чихуахуа (значит нумерация должна быть такой - Главная - 1, Собаки - 2, Чихуахуа - 3


Хлебные крошки на странице объявления:

{%if $modtype == 'msg'%}
{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb s13 f-l bread-product">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content=""></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}


Хлебные крошки на странице категории:

{%if $modtype != 'ind'%}
{%if $smarty.get.cat.1 != 'register' && $modtype != 'msg'%}{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb f-l s13">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content=""></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}

Автор:  Ruslan [ 04 ноя 2021, 21:44 ]
Заголовок сообщения:  Re: Микроразметка хлебных крошек

Михаил писал(а):
Юра, привет! Помоги сделать нумерацию itemprop="position" content=""
Есть такая цепочка - Главная / Собаки / Чихуахуа (значит Главная - 1, Собаки - 2, Чихуахуа - 3

{%if $modtype != 'ind'%}
{%if $smarty.get.cat.1 != 'register' && $modtype != 'msg'%}{%if $title_normal|@count > 2 || $modtype == 'msg'%}
<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb f-l s13"> {%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemprop="itemListElement" itemscope="" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content=""></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}


можете поставить 1,2,3 или поставьте номер id категории

Автор:  Иван [ 04 ноя 2021, 22:55 ]
Заголовок сообщения:  Re: Микроразметка хлебных крошек

Михаил писал(а):
Юра, привет! Помоги сделать нумерацию itemprop="position" content=""
Есть такая цепочка - Главная / Собаки / Чихуахуа (значит Главная - 1, Собаки - 2, Чихуахуа - 3


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

Код:
Для просмотра Вы должны быть в группе пользователей Elite-Board.

Автор:  Михаил [ 05 ноя 2021, 11:22 ]
Заголовок сообщения:  Re: Микроразметка хлебных крошек

Михаил писал(а):
Юра, привет! Помоги сделать нумерацию itemprop="position" content=""
Есть такая цепочка навигации на странице объявления/категории - Главная / Собаки / Чихуахуа (значит нумерация должна быть такой - Главная - 1, Собаки - 2, Чихуахуа - 3


Хлебные крошки на странице объявления:

{%if $modtype == 'msg'%}
{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb s13 f-l bread-product">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content=""></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}


Хлебные крошки на странице категории:

{%if $modtype != 'ind'%}
{%if $smarty.get.cat.1 != 'register' && $modtype != 'msg'%}{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb f-l s13">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content=""></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}



Получилось сделать нумерацию на странице объявления таким образом:

{%if $modtype == 'msg'%}
{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb s13 f-l bread-product">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="1">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2' name='nt2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content="{%$smarty.foreach.nt2.iteration+1%}"></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}

Для ссылки "Главная" она всегда первая делаем так - <meta itemprop="position" content="1">
Для последующих ссылок делаем так - <meta itemprop="position" content="{%$smarty.foreach.nt2.iteration+1%}">

На странице категории по такой схеме не получается пронумеровать...

Автор:  Михаил [ 05 ноя 2021, 11:36 ]
Заголовок сообщения:  Re: Микроразметка хлебных крошек

Ruslan писал(а):
Михаил писал(а):
Юра, привет! Помоги сделать нумерацию itemprop="position" content=""
Есть такая цепочка - Главная / Собаки / Чихуахуа (значит Главная - 1, Собаки - 2, Чихуахуа - 3

{%if $modtype != 'ind'%}
{%if $smarty.get.cat.1 != 'register' && $modtype != 'msg'%}{%if $title_normal|@count > 2 || $modtype == 'msg'%}
<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb f-l s13"> {%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemprop="itemListElement" itemscope="" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content=""></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}


можете поставить 1,2,3 или поставьте номер id категории


Привет, Руслан. Вот именно, как поставить 1,2,3? Номер id категории не решает задачу, он просто выведет номер категории, а нужно вывести номера элементов навигации, чтобы поисковик смог выстроить цепочку правильно Главная / Собаки / Чихуахуа

Автор:  Иван [ 05 ноя 2021, 11:56 ]
Заголовок сообщения:  Re: Микроразметка хлебных крошек

Михаил писал(а):
На странице категории по такой схеме не получается пронумеровать...


Ну тогда не используйте счетчик итераций, просто создайте переменную со значением 0
И в обоих циклах плюсует ее на 1

{%assign var='num' value=0%}
{%foreach from=$title_normal item='t' name='t'%}
{%assign var='num' value=$num+1%}

<meta itemprop="position" content="{%$num%}">

И во втором условии так же
{%foreach from=$breadcrumb item='t2'%}
{%assign var='num' value=$num+1%}
<meta itemprop="position" content="{%$num%}">

Для просмотра Вы должны быть в группе пользователей Elite-Board.

Автор:  Михаил [ 05 ноя 2021, 13:10 ]
Заголовок сообщения:  Re: Микроразметка хлебных крошек

Иван писал(а):
Михаил писал(а):
На странице категории по такой схеме не получается пронумеровать...


Ну тогда не используйте счетчик итераций, просто создайте переменную со значением 0
И в обоих циклах плюсует ее на 1

{%assign var='num' value=0%}
{%foreach from=$title_normal item='t' name='t'%}
{%assign var='num' value=$num+1%}

<meta itemprop="position" content="{%$num%}">

И во втором условии так же
{%foreach from=$breadcrumb item='t2'%}
{%assign var='num' value=$num+1%}
<meta itemprop="position" content="{%$num%}">

Скрытый текст


Привет, Иван. предложенный Вами метод с переменной не сработал. Выводит только 1 для первого элемента цепочки "Главная", а в остальных элементах itemprop="position" content="" вообще отсутствует!

{%if $modtype != 'ind'%}
{%if $smarty.get.cat.1 != 'register' && $modtype != 'msg'%}{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb f-l s13">{%assign var='num' value=0%}
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}{%assign var='num' value=$num+0%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="{%$num%}">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2'}{%assign var='num' value=$num+1%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content="{%$num%}"></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}

Автор:  Ruslan [ 05 ноя 2021, 13:34 ]
Заголовок сообщения:  Re: Микроразметка хлебных крошек

Михаил писал(а):
Михаил писал(а):
Юра, привет! Помоги сделать нумерацию itemprop="position" content=""
Есть такая цепочка навигации на странице объявления/категории - Главная / Собаки / Чихуахуа (значит нумерация должна быть такой - Главная - 1, Собаки - 2, Чихуахуа - 3


Хлебные крошки на странице объявления:

{%if $modtype == 'msg'%}
{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb s13 f-l bread-product">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content=""></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}


Хлебные крошки на странице категории:

{%if $modtype != 'ind'%}
{%if $smarty.get.cat.1 != 'register' && $modtype != 'msg'%}{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb f-l s13">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content=""></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}



Получилось сделать нумерацию на странице объявления таким образом:

{%if $modtype == 'msg'%}
{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb s13 f-l bread-product">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="1">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2' name='nt2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content="{%$smarty.foreach.nt2.iteration+1%}"></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}

Для ссылки "Главная" она всегда первая делаем так - <meta itemprop="position" content="1">
Для последующих ссылок делаем так - <meta itemprop="position" content="{%$smarty.foreach.nt2.iteration+1%}">

На странице категории по такой схеме не получается пронумеровать...

вместо этого {%if $modtype == 'msg'%}поставь {%if $modtype == 'cat'%}

Автор:  Михаил [ 05 ноя 2021, 13:45 ]
Заголовок сообщения:  Re: Микроразметка хлебных крошек

Ruslan писал(а):
Михаил писал(а):
Михаил писал(а):
Юра, привет! Помоги сделать нумерацию itemprop="position" content=""
Есть такая цепочка навигации на странице объявления/категории - Главная / Собаки / Чихуахуа (значит нумерация должна быть такой - Главная - 1, Собаки - 2, Чихуахуа - 3


Хлебные крошки на странице объявления:

{%if $modtype == 'msg'%}
{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb s13 f-l bread-product">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content=""></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}


Хлебные крошки на странице категории:

{%if $modtype != 'ind'%}
{%if $smarty.get.cat.1 != 'register' && $modtype != 'msg'%}{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb f-l s13">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content=""></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}



Получилось сделать нумерацию на странице объявления таким образом:

{%if $modtype == 'msg'%}
{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb s13 f-l bread-product">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="1">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2' name='nt2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content="{%$smarty.foreach.nt2.iteration+1%}"></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}

Для ссылки "Главная" она всегда первая делаем так - <meta itemprop="position" content="1">
Для последующих ссылок делаем так - <meta itemprop="position" content="{%$smarty.foreach.nt2.iteration+1%}">

На странице категории по такой схеме не получается пронумеровать...

вместо этого {%if $modtype == 'msg'%}поставь {%if $modtype == 'cat'%}


Это не помогает...

Автор:  Михаил [ 05 ноя 2021, 13:58 ]
Заголовок сообщения:  Re: Микроразметка хлебных крошек

Юра, посмотри если есть время.

Эта конструкция выводит нумерацию в хлебных крошках на странице объявлений, а в категориях нет.

<meta itemprop="position" content="1">
<meta itemprop="position" content="{%$smarty.foreach.nt2.iteration+1%}">


Это хлебные крошки для объявлений

{%if $modtype == 'msg'%}
{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb s13 f-l bread-product">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="1">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2' name='nt2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content="{%$smarty.foreach.nt2.iteration+1%}"></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}


Это хлебные крошки для категории

{%if $modtype != 'ind'%}
{%if $smarty.get.cat.1 != 'register' && $modtype != 'msg'%}{%if $title_normal|@count > 2 || $modtype == 'msg'%}<ol itemscope="" itemtype="http://schema.org/BreadcrumbList" class="breadcrumb f-l s13">
{%foreach from=$title_normal item='t' name='t'%}
{%if !$smarty.foreach.t.last%}<li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">{%if $smarty.foreach.t.first%}<a itemprop="item" title="" href="{%$t.link%}"><span itemprop="name">Главная</span></a><meta itemprop="position" content="1">{%else%}<a title="" href='{%$t.link%}'>{%$t.name%}</a>{%/if%}</li>{%/if%}
{%if $smarty.foreach.t.first%}{%if $modtype == 'msg'%}{%assign var='breadcrumb' value=$message.cat|breadcrumb:$categories%}
{%foreach from=$breadcrumb item='t2' name='nt2'%} <li itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem"><a itemprop="item" title="" href="{%$t2.href%}"><span itemprop="name">{%$t2.name%}</span></a><meta itemprop="position" content="{%$smarty.foreach.nt2.iteration+1%}"></li>{%/foreach%}{%/if%}{%/if%}
{%/foreach%}</ol>{%/if%}{%/if%}

Без нумерации микроразметка не проходит валидацию

Страница 1 из 2 Часовой пояс: UTC + 3 часа
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/