feat: update doctor display logic to prioritize display_name and enhance metadata description with address details
This commit is contained in:
@@ -39,7 +39,7 @@ function ItemDoctor({ doctor, loading, setDoctors, priority = false }) {
|
|||||||
<TextLoading loading={loading} width={90} height={15}>
|
<TextLoading loading={loading} width={90} height={15}>
|
||||||
<Link href={`/doctor/${doctor?.uuid}`}>
|
<Link href={`/doctor/${doctor?.uuid}`}>
|
||||||
<p className="text-[#3B3B3B] text-[14px] font-bold">
|
<p className="text-[#3B3B3B] text-[14px] font-bold">
|
||||||
{doctor?.name}
|
{doctor?.display_name || doctor?.name}
|
||||||
</p>
|
</p>
|
||||||
</Link>
|
</Link>
|
||||||
</TextLoading>
|
</TextLoading>
|
||||||
@@ -92,13 +92,13 @@ function ItemDoctor({ doctor, loading, setDoctors, priority = false }) {
|
|||||||
{/* Arrow */}
|
{/* Arrow */}
|
||||||
<Link
|
<Link
|
||||||
href={`/doctor/${doctor?.uuid}`}
|
href={`/doctor/${doctor?.uuid}`}
|
||||||
aria-label={`مشاهده پروفایل ${doctor?.name || "پزشک"}`}
|
aria-label={`مشاهده پروفایل ${doctor?.display_name || doctor?.name || "پزشک"}`}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={handleLoading}
|
onClick={handleLoading}
|
||||||
disabled={doctor?.loading}
|
disabled={doctor?.loading}
|
||||||
aria-label={`مشاهده پروفایل ${doctor?.name || "پزشک"}`}
|
aria-label={`مشاهده پروفایل ${doctor?.display_name || doctor?.name || "پزشک"}`}
|
||||||
className="!p-[14px] !absolute !left-4 !bottom-4 !rounded-full !w-fit"
|
className="!p-[14px] !absolute !left-4 !bottom-4 !rounded-full !w-fit"
|
||||||
>
|
>
|
||||||
<div className={doctor && doctor.loading ? "opacity-0" : ""}>
|
<div className={doctor && doctor.loading ? "opacity-0" : ""}>
|
||||||
|
|||||||
@@ -76,9 +76,13 @@ export async function generateMetadata({ params }) {
|
|||||||
.replace(/<[^>]*>/g, "")
|
.replace(/<[^>]*>/g, "")
|
||||||
.replace(/\s+/g, " ")
|
.replace(/\s+/g, " ")
|
||||||
.trim();
|
.trim();
|
||||||
|
// doctor.address آرایهای از آبجکت آدرس است؛ متن آدرس یا نام شهر را میگیریم
|
||||||
|
// (الحاق مستقیم آرایه «[object Object]» میساخت).
|
||||||
|
const firstAddress = Array.isArray(doctor.address) ? doctor.address[0] : null;
|
||||||
|
const addressText = firstAddress?.address || firstAddress?.city?.name || "";
|
||||||
const description = (
|
const description = (
|
||||||
detailText ||
|
detailText ||
|
||||||
`رزرو نوبت آنلاین ${doctorTitle(doctor.name)}${specialtyNames ? " متخصص " + specialtyNames : ""}${doctor.address ? " | " + doctor.address : ""}`.trim()
|
`رزرو نوبت آنلاین ${doctorTitle(doctor.name)}${specialtyNames ? " متخصص " + specialtyNames : ""}${addressText ? " | " + addressText : ""}`.trim()
|
||||||
).slice(0, 160);
|
).slice(0, 160);
|
||||||
const image = imageUrl(doctor.img?.[0]?.url) || FALLBACK_IMG;
|
const image = imageUrl(doctor.img?.[0]?.url) || FALLBACK_IMG;
|
||||||
// C1-b — پزشک به دامنهٔ شهر خودش canonical میشود، روی هر دامنهای که سرو شود.
|
// C1-b — پزشک به دامنهٔ شهر خودش canonical میشود، روی هر دامنهای که سرو شود.
|
||||||
|
|||||||
Reference in New Issue
Block a user