0
0

Add schema.org Product and Offer properties

This commit is contained in:
Sergey Chebotar 2023-06-21 09:47:47 +03:00
parent c2db294e08
commit 2148282b07

View File

@ -16,7 +16,9 @@
@foreach (var product in products) @foreach (var product in products)
{ {
<div class="col mb-5"> <div class="col mb-5">
<div class="card h-100"> <div class="card h-100" itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="@product.Name"/>
<meta itemprop="description" content="@product.Description"/>
@{ @{
var figure = product.Figures.First(); var figure = product.Figures.First();
var filePath = $"/Content/{product.Id}/{figure.Id}.jpg"; var filePath = $"/Content/{product.Id}/{figure.Id}.jpg";
@ -24,7 +26,7 @@
} }
<a data-src="@filePath" data-fancybox="@product.Id" <a data-src="@filePath" data-fancybox="@product.Id"
data-caption="@figure.Description"><img class="card-img-top" data-caption="@figure.Description"><img class="card-img-top"
src="@thumbnailPath" alt="@product.Name" /></a> src="@thumbnailPath" alt="@product.Name" itemprop="image"/></a>
@for (int i = 1; i < product.Figures.Count(); i++) @for (int i = 1; i < product.Figures.Count(); i++)
{ {
filePath = $"/Content/{product.Id}/{product.Figures[i].Id}.jpg"; filePath = $"/Content/{product.Id}/{product.Figures[i].Id}.jpg";
@ -32,9 +34,11 @@
data-caption="@product.Figures[i].Description"></a> data-caption="@product.Figures[i].Description"></a>
} }
<div class="card-body p-4"> <div class="card-body p-4">
<div class="text-center"> <div class="text-center" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<h5 class="fw-bolder">@product.Name</h5> <h5 class="fw-bolder" itemprop="name">@product.Name</h5>
@String.Format(new CultureInfo("ru-RU"), "{0:C0}", product.Price) <span>@String.Format(new CultureInfo("ru-RU"), "{0:C0}", product.Price)</span>
<meta itemprop="price" content="@product.Price"/>
<meta itemprop="priceCurrency" content="RUB"/>
</div> </div>
</div> </div>
</div> </div>