Breadcrumbs: visible trail + BreadcrumbList JSON-LD
Add SeoJsonLd.Breadcrumb + Crumb record + _Breadcrumbs partial, and wire a trail
into the Jobs/Shifts list (landing) and detail pages: خانه › استخدام/شیفت › {نقش}
› {شهر|عنوان}. The role crumb links to the role landing page (more internal
links), and Google can show the breadcrumb path in results. Detail pages emit it
alongside the existing JobPosting JSON-LD.
Improvement 5 of the backlog (SEO).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -23,10 +23,14 @@
|
||||
if (j.SalaryMin is null && j.SalaryMax is null) salary = "توافقی";
|
||||
else if (j.SalaryMin == j.SalaryMax) salary = JalaliDate.Toman(j.SalaryMin) + " ماهانه";
|
||||
else salary = $"از {JalaliDate.ToPersianDigits((j.SalaryMin ?? 0).ToString("#,0"))} تا {JalaliDate.Toman(j.SalaryMax)} ماهانه";
|
||||
var crumbs = new List<JobsMedical.Web.Services.Crumb> { new("خانه", "/"), new("استخدام", "/Jobs") };
|
||||
if (j.Role is not null) crumbs.Add(new(j.Role.Name, "/استخدام/" + JobsMedical.Web.Services.SeoSlug.Of(j.Role.Name)));
|
||||
crumbs.Add(new(j.Title, null));
|
||||
}
|
||||
|
||||
<div class="page-head">
|
||||
<div class="container">
|
||||
<partial name="_Breadcrumbs" model="crumbs" />
|
||||
<div class="row" style="display:flex; gap:10px; align-items:center;">
|
||||
<span class="badge badge-job">@empLabel</span>
|
||||
@if (j.Role is not null) { <span class="badge badge-type">@j.Role.Name</span> }
|
||||
@@ -199,9 +203,10 @@
|
||||
@section Head {
|
||||
@* 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). *@
|
||||
@{ var bu = $"{ViewContext.HttpContext.Request.Scheme}://{ViewContext.HttpContext.Request.Host}"; }
|
||||
@Html.Raw("<script type=\"application/ld+json\">" + JobsMedical.Web.Services.SeoJsonLd.Breadcrumb(crumbs, bu) + "</script>")
|
||||
@if (JobsMedical.Web.Services.SeoJsonLd.HasRealEmployer(f))
|
||||
{
|
||||
var bu = $"{ViewContext.HttpContext.Request.Scheme}://{ViewContext.HttpContext.Request.Host}";
|
||||
@Html.Raw("<script type=\"application/ld+json\">" + JobsMedical.Web.Services.SeoJsonLd.JobPosting(j, bu) + "</script>")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
<div class="page-head">
|
||||
<div class="container">
|
||||
<partial name="_Breadcrumbs" model="Model.Breadcrumbs" />
|
||||
<h1>@Model.PageHeading</h1>
|
||||
<p class="muted">
|
||||
@JalaliDate.ToPersianDigits(Model.Results.Count.ToString()) موقعیت شغلی پیدا شد
|
||||
@@ -140,3 +141,8 @@
|
||||
}
|
||||
</script>
|
||||
}
|
||||
|
||||
@section Head {
|
||||
@{ var bcUrl = $"{ViewContext.HttpContext.Request.Scheme}://{ViewContext.HttpContext.Request.Host}"; }
|
||||
@Html.Raw("<script type=\"application/ld+json\">" + JobsMedical.Web.Services.SeoJsonLd.Breadcrumb(Model.Breadcrumbs, bcUrl) + "</script>")
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ public class IndexModel : PageModel
|
||||
/// <summary>A short unique intro shown on role/city landing pages (avoids thin-content).</summary>
|
||||
public string? PageIntro { get; private set; }
|
||||
|
||||
/// <summary>Breadcrumb trail (also emitted as BreadcrumbList JSON-LD).</summary>
|
||||
public IReadOnlyList<Crumb> Breadcrumbs { get; private set; } = Array.Empty<Crumb>();
|
||||
|
||||
public async Task<IActionResult> OnGetAsync()
|
||||
{
|
||||
Cities = await _db.Cities.Where(c => c.IsActive).OrderBy(c => c.Name).ToListAsync();
|
||||
@@ -110,5 +113,10 @@ public class IndexModel : PageModel
|
||||
PageIntro = $"در این صفحه جدیدترین فرصتهای {PageHeading}، گردآوریشده از منابع معتبر، را میبینید. "
|
||||
+ "روی هر آگهی بزنید تا جزئیات، شرایط و راهِ تماسِ مستقیم با مرکز درمانی نمایش داده شود. "
|
||||
+ "برای فرصتهای مرتبط، نقش یا شهر دیگری را از لینکهای بالا انتخاب کنید.";
|
||||
|
||||
var crumbs = new List<Crumb> { new("خانه", "/"), new("استخدام", "/Jobs") };
|
||||
if (role is not null) crumbs.Add(new(role, "/استخدام/" + SeoSlug.Of(role)));
|
||||
if (city is not null) crumbs.Add(new(city, null));
|
||||
Breadcrumbs = crumbs;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user