Fix empty hrefs on nav and homepage «مشاهده همه» links
The SEO routes added a required slug («شیفت/{roleSlug}»), which made asp-page=/Shifts/Index
and /Jobs/Index generate an EMPTY href whenever no slug was supplied — so the nav «شیفتها/
استخدام» and the homepage «مشاهده همه» links did nothing (Talent, which has no custom route, worked).
Fix: make the slug optional ({roleSlug?}) so URL generation succeeds, and point the nav + homepage
view-all links at the plain /Shifts and /Jobs routes as a guaranteed fallback.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -79,7 +79,7 @@
|
||||
<div class="container">
|
||||
<div class="section-head">
|
||||
<h2>جدیدترین شیفتها</h2>
|
||||
<a asp-page="/Shifts/Index">مشاهده همه ←</a>
|
||||
<a href="/Shifts">مشاهده همه ←</a>
|
||||
</div>
|
||||
@if (Model.LatestShifts.Count == 0)
|
||||
{
|
||||
@@ -103,7 +103,7 @@
|
||||
<div class="container">
|
||||
<div class="section-head">
|
||||
<h2>فرصتهای استخدامی</h2>
|
||||
<a asp-page="/Jobs/Index">مشاهده همه ←</a>
|
||||
<a href="/Jobs">مشاهده همه ←</a>
|
||||
</div>
|
||||
<div class="grid grid-3">
|
||||
@foreach (var j in Model.LatestJobs)
|
||||
|
||||
@@ -111,8 +111,8 @@
|
||||
<div class="nav-collapse">
|
||||
<nav class="main-nav">
|
||||
<a asp-page="/Index" class="@(path == "/" ? "active" : null)">خانه</a>
|
||||
<a asp-page="/Shifts/Index" data-tour="shifts" class="@(path.StartsWith("/Shifts") ? "active" : null)">شیفتها</a>
|
||||
<a asp-page="/Jobs/Index" data-tour="jobs" class="@(path.StartsWith("/Jobs") ? "active" : null)">استخدام</a>
|
||||
<a href="/Shifts" data-tour="shifts" class="@(path.StartsWith("/Shifts") ? "active" : null)">شیفتها</a>
|
||||
<a href="/Jobs" data-tour="jobs" class="@(path.StartsWith("/Jobs") ? "active" : null)">استخدام</a>
|
||||
<a asp-page="/Talent/Index" class="@(path.StartsWith("/Talent") ? "active" : null)">آماده به کار</a>
|
||||
<a asp-page="/Facilities/Index" class="@(path.StartsWith("/Facilities") ? "active" : null)">مراکز درمانی</a>
|
||||
<a asp-page="/Calendar/Index" class="@(path.StartsWith("/Calendar") ? "active" : null)">تقویم هفتگی</a>
|
||||
|
||||
@@ -16,8 +16,11 @@ builder.Services.AddRazorPages(options =>
|
||||
{
|
||||
// Pretty SEO landing routes that target «استخدام [نقش] [شهر]» / «شیفت …» searches, in addition
|
||||
// to the query-string forms (/Jobs?RoleId=…&CityId=…). The page resolves the slugs to filters.
|
||||
options.Conventions.AddPageRoute("/Jobs/Index", "استخدام/{roleSlug}/{citySlug?}");
|
||||
options.Conventions.AddPageRoute("/Shifts/Index", "شیفت/{roleSlug}/{citySlug?}");
|
||||
// roleSlug is OPTIONAL: a required slug made `asp-page="/Shifts/Index"` (with no slug) generate an
|
||||
// empty href, breaking the nav «شیفتها/استخدام» and the homepage «مشاهده همه» links. Optional →
|
||||
// generation succeeds (e.g. «/شیفت») and the slug landing pages still work.
|
||||
options.Conventions.AddPageRoute("/Jobs/Index", "استخدام/{roleSlug?}/{citySlug?}");
|
||||
options.Conventions.AddPageRoute("/Shifts/Index", "شیفت/{roleSlug?}/{citySlug?}");
|
||||
});
|
||||
|
||||
// Interest tracking + recommendation engine.
|
||||
|
||||
Reference in New Issue
Block a user