From 9bf67ffa383e5b1a8a3393cf7d114278b83dbc7c Mon Sep 17 00:00:00 2001 From: Claw AI Date: Mon, 30 Mar 2026 14:07:52 +0000 Subject: [PATCH] Add SweetHome logo as OG image fallback for Facebook share - Always includes logo.png as OG image - Property images shown first if available, logo as second - If no property images, shows logo only --- app/property/[id]/page.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/property/[id]/page.js b/app/property/[id]/page.js index 993d40b..2c1191f 100644 --- a/app/property/[id]/page.js +++ b/app/property/[id]/page.js @@ -61,9 +61,15 @@ export async function generateMetadata({ params }) { const p = mapProperty(raw); const priceStr = `${p.price.toLocaleString()} ل.س / ${p.priceUnit === 'daily' ? 'يوم' : 'شهر'}`; - const imageUrl = p.image + const propertyImage = p.image ? (p.image.startsWith('http') ? p.image : `http://45.93.137.91${p.image}`) : ''; + const logoUrl = `http://45.93.137.91/logo.png`; + + // Use property image if available, otherwise logo + const ogImages = propertyImage + ? [{ url: propertyImage, width: 1200, height: 630 }, { url: logoUrl, width: 512, height: 512 }] + : [{ url: logoUrl, width: 512, height: 512 }]; return { title: `${p.title} - ${priceStr}`, @@ -71,8 +77,8 @@ export async function generateMetadata({ params }) { openGraph: { title: `${p.title} - ${priceStr}`, description: p.description, - images: imageUrl ? [imageUrl] : [], - url: `https://sweethome.example/property/${id}`, + images: ogImages, + url: `http://45.93.137.91/property/${id}`, type: 'website', siteName: 'SweetHome', }, @@ -80,7 +86,7 @@ export async function generateMetadata({ params }) { card: 'summary_large_image', title: `${p.title} - ${priceStr}`, description: p.description, - images: imageUrl ? [imageUrl] : [], + images: ogImages.map(i => i.url), }, }; }