feat(seo): emit openingHoursSpecification per work location
The doctor page listed where a doctor works but never when, so search engines had no working hours for any location. booking_locations now carries opening_hours per context, so each MedicalClinic in the Physician JSON-LD gets its own openingHoursSpecification, matched to the address by uuid. Verified against the rendered page: the clinic location emits five shifts with schema.org weekday URLs alongside the availableService entries. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -129,6 +129,14 @@ async function Doctor({ params }) {
|
||||
? await Promise.all([getDoctorAddresses(doctor.id), getBookingLocations(doctor.uuid)])
|
||||
: [[], []];
|
||||
|
||||
// ساعات کاری per-location است؛ با uuid آدرس به هر محل وصل میشود.
|
||||
const openingHoursByLocation = bookingLocations.reduce((acc, location) => {
|
||||
if (location.location_uuid && location.opening_hours?.length) {
|
||||
acc[location.location_uuid] = location.opening_hours;
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
// سرویسهای قابل رزرو، تجمیعشده از همهٔ محلها و یکتاشده بر اساس uuid.
|
||||
const bookableServices = Object.values(
|
||||
bookingLocations
|
||||
@@ -192,6 +200,14 @@ async function Doctor({ params }) {
|
||||
streetAddress: addr.address,
|
||||
},
|
||||
...(addr.telephone && { telephone: addr.telephone }),
|
||||
...(openingHoursByLocation[addr.uuid]?.length && {
|
||||
openingHoursSpecification: openingHoursByLocation[addr.uuid].map((shift) => ({
|
||||
"@type": "OpeningHoursSpecification",
|
||||
dayOfWeek: `https://schema.org/${shift.day}`,
|
||||
opens: shift.opens,
|
||||
closes: shift.closes,
|
||||
})),
|
||||
}),
|
||||
...(addr.map?.latitude && addr.map?.longitude && {
|
||||
geo: {
|
||||
"@type": "GeoCoordinates",
|
||||
|
||||
Reference in New Issue
Block a user