Offerings: beschrijving en prijsnotitie optioneel (API, admin, index-markers, OpenAPI)
Ontbrekend/null/leeg wordt als lege string opgeslagen en teruggegeven; JSON-LD laat description weg en de HTML-markers renderen geen lege <p>. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,10 +64,14 @@ public sealed partial class OfferingsIndexMarkers(IOfferingsService offerings) :
|
||||
{
|
||||
["@type"] = "Offer",
|
||||
["name"] = o.Title,
|
||||
["description"] = o.Description,
|
||||
["url"] = baseUrl + "/#pakketten",
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(o.Description))
|
||||
{
|
||||
offer["description"] = o.Description;
|
||||
}
|
||||
|
||||
if (ParsePrice(o.Price) is { } price)
|
||||
{
|
||||
offer["price"] = price;
|
||||
@@ -104,9 +108,18 @@ public sealed partial class OfferingsIndexMarkers(IOfferingsService offerings) :
|
||||
foreach (var o in list)
|
||||
{
|
||||
var priceLine = string.Join(' ', new[] { o.Price, o.PriceNote }.Where(part => !string.IsNullOrWhiteSpace(part)));
|
||||
html.Append("<li><h3>").Append(WebUtility.HtmlEncode(o.Title)).Append("</h3><p>")
|
||||
.Append(WebUtility.HtmlEncode(o.Description)).Append("</p><p>")
|
||||
.Append(WebUtility.HtmlEncode(priceLine)).Append("</p></li>");
|
||||
html.Append("<li><h3>").Append(WebUtility.HtmlEncode(o.Title)).Append("</h3>");
|
||||
if (!string.IsNullOrWhiteSpace(o.Description))
|
||||
{
|
||||
html.Append("<p>").Append(WebUtility.HtmlEncode(o.Description)).Append("</p>");
|
||||
}
|
||||
|
||||
if (priceLine.Length > 0)
|
||||
{
|
||||
html.Append("<p>").Append(WebUtility.HtmlEncode(priceLine)).Append("</p>");
|
||||
}
|
||||
|
||||
html.Append("</li>");
|
||||
}
|
||||
|
||||
return html.Append("</ul></section>").ToString();
|
||||
|
||||
@@ -36,9 +36,9 @@ public class OfferingsService(
|
||||
Id = Guid.NewGuid(),
|
||||
Slug = await ResolveSlugAsync(request.Slug, request.Title),
|
||||
Title = request.Title,
|
||||
Description = request.Description,
|
||||
Description = request.Description ?? string.Empty,
|
||||
Price = request.Price,
|
||||
PriceNote = request.PriceNote,
|
||||
PriceNote = request.PriceNote ?? string.Empty,
|
||||
Features = request.Features,
|
||||
CtaLabel = request.CtaLabel,
|
||||
CategoryId = category?.Id,
|
||||
@@ -97,9 +97,9 @@ public class OfferingsService(
|
||||
}
|
||||
|
||||
offering.Title = request.Title;
|
||||
offering.Description = request.Description;
|
||||
offering.Description = request.Description ?? string.Empty;
|
||||
offering.Price = request.Price;
|
||||
offering.PriceNote = request.PriceNote;
|
||||
offering.PriceNote = request.PriceNote ?? string.Empty;
|
||||
offering.Features = request.Features;
|
||||
offering.CtaLabel = request.CtaLabel;
|
||||
offering.CategoryId = category?.Id;
|
||||
|
||||
Reference in New Issue
Block a user