diff --git a/src/JobsMedical.Web/Pages/Jobs/Details.cshtml b/src/JobsMedical.Web/Pages/Jobs/Details.cshtml index 92e2f99..7867d6d 100644 --- a/src/JobsMedical.Web/Pages/Jobs/Details.cshtml +++ b/src/JobsMedical.Web/Pages/Jobs/Details.cshtml @@ -197,6 +197,11 @@ } @section Head { - @{ var bu = $"{ViewContext.HttpContext.Request.Scheme}://{ViewContext.HttpContext.Request.Host}"; } - @Html.Raw("") + @* Only emit JobPosting structured data for a real named employer — Google for Jobs rejects a + placeholder/empty hiringOrganization (most aggregated ads have no named center). *@ + @if (JobsMedical.Web.Services.SeoJsonLd.HasRealEmployer(f)) + { + var bu = $"{ViewContext.HttpContext.Request.Scheme}://{ViewContext.HttpContext.Request.Host}"; + @Html.Raw("") + } } diff --git a/src/JobsMedical.Web/Pages/Shifts/Details.cshtml b/src/JobsMedical.Web/Pages/Shifts/Details.cshtml index 755cbd5..d14e055 100644 --- a/src/JobsMedical.Web/Pages/Shifts/Details.cshtml +++ b/src/JobsMedical.Web/Pages/Shifts/Details.cshtml @@ -216,6 +216,10 @@ } @section Head { - @{ var bu = $"{ViewContext.HttpContext.Request.Scheme}://{ViewContext.HttpContext.Request.Host}"; } - @Html.Raw("") + @* Only for a real named employer — Google for Jobs rejects a placeholder hiringOrganization. *@ + @if (JobsMedical.Web.Services.SeoJsonLd.HasRealEmployer(f)) + { + var bu = $"{ViewContext.HttpContext.Request.Scheme}://{ViewContext.HttpContext.Request.Host}"; + @Html.Raw("") + } } diff --git a/src/JobsMedical.Web/Services/SeoJsonLd.cs b/src/JobsMedical.Web/Services/SeoJsonLd.cs index 6ceff92..2179f91 100644 --- a/src/JobsMedical.Web/Services/SeoJsonLd.cs +++ b/src/JobsMedical.Web/Services/SeoJsonLd.cs @@ -16,6 +16,12 @@ public static class SeoJsonLd DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }; + /// Whether a facility is a REAL named employer (not the «نامشخص» placeholder used for + /// aggregated ads with no named center). Google for Jobs rejects a JobPosting whose + /// hiringOrganization is empty/placeholder, so callers should skip the JSON-LD when this is false. + public static bool HasRealEmployer(Facility? f) + => f is not null && !string.IsNullOrWhiteSpace(f.Name) && !f.Name.Contains("نامشخص") && !f.Name.Contains("ثبت نشده"); + public static string ShiftPosting(Shift s, string baseUrl) { var typeLabel = s.ShiftType switch