fix: replace emoji with hero image in blog sidebar doctor card
CI/CD / CI · dotnet build (push) Successful in 51s
CI/CD / Deploy · drsousan (push) Failing after 5m40s

- Post.cshtml.cs: load hero image, tag from SiteSettings in SetViewDataAsync
- Post.cshtml: show <img> with hero image in .doc-avatar when set,
  fall back to emoji only if no image is configured
- .doc-avatar: circular crop with object-fit:cover, gold border
- doc-title now uses HeroTag from settings (not hardcoded)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-02 15:15:06 +03:30
parent ed25bec200
commit b3c4615bc7
2 changed files with 20 additions and 6 deletions
+6 -3
View File
@@ -135,9 +135,12 @@ public class PostModel : PageModel
ViewData["ArticleType"] = post.ArticleType;
ViewData["Slug"] = post.Slug;
var s = await _db.SiteSettings
.FirstOrDefaultAsync(x => x.Section == "hero" && x.Key == "name");
ViewData["SiteName"] = s?.Value ?? "دکتر سوسن آل‌طه";
var heroSettings = await _db.SiteSettings
.Where(x => x.Section == "hero" && (x.Key == "name" || x.Key == "image" || x.Key == "tag"))
.ToListAsync();
ViewData["SiteName"] = heroSettings.FirstOrDefault(x => x.Key == "name")?.Value ?? "دکتر سوسن آل‌طه";
ViewData["HeroImage"] = heroSettings.FirstOrDefault(x => x.Key == "image")?.Value ?? "";
ViewData["HeroTag"] = heroSettings.FirstOrDefault(x => x.Key == "tag")?.Value ?? "پزشک عمومی و متخصص زیبایی پوست";
}
// View model for comments