SEO landing pages: dynamic role+city titles, pretty URLs, sitemap combos
CI/CD / CI · dotnet build (push) Successful in 4m5s
CI/CD / Deploy · hamkadr (push) Successful in 3m36s

Google Search Console shows all top queries are «استخدام [نقش] [شهر]», but the
filtered index pages all shared the generic title «موقعیت‌های استخدامی» and
weren't in the sitemap, so nothing ranked for those exact searches.

- Jobs/Shifts/Talent index pages now set a dynamic <title>/<h1>/meta from the
  active role+city (e.g. «استخدام پزشک عمومی در تهران»).
- Pretty SEO routes /استخدام/{role}/{city?} and /شیفت/{role}/{city?} (via
  AddPageRoute) resolve slugs → filters; unknown slug → 404. The layout already
  derives the canonical from the path, so each pretty URL is its own canonical
  and the query-string forms canonicalize to /Jobs (no duplicate content).
- sitemap.xml now lists role-only and role×city landing URLs for every combo
  with live listings (URL-encoded), so Google discovers them.
- New SeoSlug helper (Persian-tolerant: ي/ك, ZWNJ, hyphen/space).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-19 14:03:57 +03:30
parent 38031cb189
commit 0cf5b30dd8
8 changed files with 154 additions and 10 deletions
@@ -23,6 +23,9 @@ public class IndexModel : PageModel
public List<District> Districts { get; private set; } = new();
public List<Role> Roles { get; private set; } = new();
/// <summary>Dynamic page heading/H1 + title, set from the active role/city for SEO.</summary>
public string PageHeading { get; private set; } = "کادر درمان آماده به کار";
public async Task OnGetAsync()
{
Cities = await _db.Cities.Where(c => c.IsActive).OrderBy(c => c.Name).ToListAsync();
@@ -58,5 +61,15 @@ public class IndexModel : PageModel
}
Results = await q.OrderByDescending(t => t.CreatedAt).ToListAsync();
var role = Roles.FirstOrDefault(r => r.Id == RoleId)?.Name;
var city = Cities.FirstOrDefault(c => c.Id == CityId)?.Name;
PageHeading =
role is not null && city is not null ? $"{role} آماده به کار در {city}"
: role is not null ? $"{role} آماده به کار"
: city is not null ? $"کادر درمان آماده به کار در {city}"
: "کادر درمان آماده به کار";
ViewData["Title"] = PageHeading;
ViewData["Description"] = $"فهرست «آماده به کار» {(role ?? "کادر درمان")}{(city is not null ? " در " + city : "")} — همکادر؛ مشاهده و تماس مستقیم.";
}
}