我正在创建工作门户,并且在主页中,其中有4个滑块,它们显示以下内容:
这4个滑块的共同点是:
背景图片,标题,副标题和URL
我应该使用哪种模式?
我尝试使用ItemList
,但在Google结构化数据测试工具上似乎无法使用。
我得到的错误是:
Multiple ItemList markups on a page are not allowed.
这是ItemList的代码段。这四个滑块的格式相似。
@if (!empty($countries))
<div itemscope itemtype="http://schema.org/ItemList">
<h2 class="mt-5" itemprop="name">Check Out This Featured Companies</h2>
<div class="featuredCompaniesDiv mb-5 pb-5">
<div class="row mb-5">
<div class="col-xs-12">
<div class="featuredCompanies">
<?php $countriesCount = 1; ?>
@foreach($countries as $country)
<div class="featuredCompanies--item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<meta itemprop="position" content="{{ $countriesCount }}">
<meta itemprop="name" content="{{ $country->company_name }}">
<meta itemprop="url" content="{{ action('PublicController@jobsByCountry', ['country' => $country->address_format]) }}">
<a class="inner-div" href="{{ action('PublicController@jobsByCountry', ['country' => $country->address_format]) }}">
<span class="post-featured-img">
<img src="/img/spacer.png" data-lazy="/img/cnt/{{ $country->iso_code_3 }}.jpg" alt="Buick Enspire" width="700" height="323">
</span>
<h3 class="top-h3">{{ $country->name }}
@if ($country->cnt == 1)
<small>({{ $country->cnt }} Job)</small>
@else
<small>({{ $country->cnt }} Jobs)</small>
@endif
</h3>
</a>
</div>
<?php $countriesCount++; ?>
@endforeach
</div>
</div>
</div>
</div>
</div>
@endif
答案 0 :(得分:1)
错误现在消失了。
这是最终代码:
@if (!empty($countries))
<div itemscope itemtype="http://schema.org/CollectionPage">
<h2 class="mt-5" itemprop="name">Check Out This Featured Companies</h2>
<div class="featuredCompaniesDiv mb-5 pb-5" itemprop="hasPart">
<div class="row mb-5">
<div class="col-xs-12">
<div class="featuredCompanies">
<?php $countriesCount = 1; ?>
@foreach($countries as $country)
<div class="featuredCompanies--item" itemscope itemtype="http://schema.org/ItemPage">
<meta itemprop="position" content="{{ $countriesCount }}">
<meta itemprop="name" content="Jobs near {{ $country->name }}">
<meta itemprop="url" content="{{ action('PublicController@jobsByCountry', ['country' => $country->address_format]) }}">
<a class="inner-div" href="{{ action('PublicController@jobsByCountry', ['country' => $country->address_format]) }}">
<span class="post-featured-img">
<img src="/img/spacer.png" data-lazy="/img/cnt/{{ $country->iso_code_3 }}.jpg" alt="Buick Enspire" width="700" height="323">
</span>
<h3 class="top-h3">{{ $country->name }}
@if ($country->cnt == 1)
<small>({{ $country->cnt }} Job)</small>
@else
<small>({{ $country->cnt }} Jobs)</small>
@endif
</h3>
</a>
</div>
<?php $countriesCount++; ?>
@endforeach
</div>
</div>
</div>
</div>
</div>
@endif