From 18484f974df9d9677829a6e77905fa4bd21653fb Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Sun, 19 Jul 2026 19:57:05 +0330 Subject: [PATCH] feat: update doctor display logic to prioritize display_name and enhance metadata description with address details --- app/component/ItemDoctor.js | 6 +++--- app/doctor/[slug]/page.js | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/component/ItemDoctor.js b/app/component/ItemDoctor.js index 9b48d81..92932e8 100644 --- a/app/component/ItemDoctor.js +++ b/app/component/ItemDoctor.js @@ -39,7 +39,7 @@ function ItemDoctor({ doctor, loading, setDoctors, priority = false }) { - {doctor?.name} + {doctor?.display_name || doctor?.name} @@ -92,13 +92,13 @@ function ItemDoctor({ doctor, loading, setDoctors, priority = false }) { {/* Arrow */} diff --git a/app/doctor/[slug]/page.js b/app/doctor/[slug]/page.js index 7793998..3507261 100644 --- a/app/doctor/[slug]/page.js +++ b/app/doctor/[slug]/page.js @@ -76,9 +76,13 @@ export async function generateMetadata({ params }) { .replace(/<[^>]*>/g, "") .replace(/\s+/g, " ") .trim(); + // doctor.address آرایهای از آبجکت آدرس است؛ متن آدرس یا نام شهر را میگیریم + // (الحاق مستقیم آرایه «[object Object]» میساخت). + const firstAddress = Array.isArray(doctor.address) ? doctor.address[0] : null; + const addressText = firstAddress?.address || firstAddress?.city?.name || ""; const description = ( detailText || - `رزرو نوبت آنلاین ${doctorTitle(doctor.name)}${specialtyNames ? " متخصص " + specialtyNames : ""}${doctor.address ? " | " + doctor.address : ""}`.trim() + `رزرو نوبت آنلاین ${doctorTitle(doctor.name)}${specialtyNames ? " متخصص " + specialtyNames : ""}${addressText ? " | " + addressText : ""}`.trim() ).slice(0, 160); const image = imageUrl(doctor.img?.[0]?.url) || FALLBACK_IMG; // C1-b — پزشک به دامنهٔ شهر خودش canonical میشود، روی هر دامنهای که سرو شود.
- {doctor?.name} + {doctor?.display_name || doctor?.name}