SEO landing pages: dynamic role+city titles, pretty URLs, sitemap combos
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:
@@ -0,0 +1,22 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace JobsMedical.Web.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Pretty-URL slugs for SEO landing pages (e.g. /استخدام/پزشک-عمومی/تهران). We keep Persian
|
||||
/// characters — Google indexes UTF-8 URLs fine and they read naturally — and just turn spaces into
|
||||
/// hyphens. Matching is tolerant of ي/ك, ZWNJ and hyphen/space variants so a hand-typed or
|
||||
/// search-engine-rewritten slug still resolves.
|
||||
/// </summary>
|
||||
public static class SeoSlug
|
||||
{
|
||||
/// <summary>The canonical slug for a role/city name («پزشک عمومی» → «پزشک-عمومی»).</summary>
|
||||
public static string Of(string? name) => Key(name);
|
||||
|
||||
/// <summary>True when <paramref name="slug"/> (from the URL) refers to <paramref name="name"/>.</summary>
|
||||
public static bool Matches(string? name, string? slug) => Key(name) == Key(slug);
|
||||
|
||||
private static string Key(string? s) => Regex.Replace(
|
||||
(s ?? "").Trim().Replace('ي', 'ی').Replace('ك', 'ک').Replace('', ' ').Replace('-', ' '),
|
||||
@"\s+", "-").ToLowerInvariant();
|
||||
}
|
||||
Reference in New Issue
Block a user