Stratégies de rendu
- SSG complet — possible pour les petits catalogues (<100 biens)
- ISR avec revalidate 10-30 min — recommandé
- Webhook on-demand revalidation — pour Sweepbright (temps réel)
Composant serveur exemple
// app/biens/page.tsx — Server Component
type Property = {
id: string
uri: { fr: string; en: string }
type: 'apartment' | 'house' | 'land' | 'commercial' | 'parking' | string
offer_type: 'sale' | 'rental' | 'auction' | string
status: 'available' | 'sold' | 'rented' | string
title: { fr: string; en?: string }
bedrooms: number | null
financial: { transaction: { price: { amount: number; currency: 'EUR' } } }
location: { city: string; postal_code: string; country: string; country_code: string }
images: { url: string; ordinal: number }[]
}
async function getProperties(agencySlug: string): Promise<Property[]> {
const res = await fetch(
`${process.env.TS_IMMO_API_URL}/v1/gateway/public/properties/${agencySlug}`,
{ next: { revalidate: 600 } }, // ISR : 10 minutes
)
if (!res.ok) throw new Error('Ts-Immo API error')
return res.json()
}
export default async function BiensPage() {
const list = await getProperties('mon-agence')
return (
<ul>
{list.map((p) => (
<li key={p.id}>
{p.title.fr} — {p.location.city} —{' '}
{p.financial.transaction.price.amount.toLocaleString('fr-FR')} €
</li>
))}
</ul>
)
}JSON-LD RealEstateListing
Schema.org propose `RealEstateListing` pour les annonces immobilières. À injecter dans chaque page de détail pour un SEO maximal. L'objet `PublicPropertyDto` retourné par Ts-Immo contient déjà tous les champs nécessaires.
{
"@context": "https://schema.org",
"@type": "RealEstateListing",
"name": "Villa 4 pièces vue mer",
"url": "https://www.exemple.fr/biens/agence-cote-d-azur/villa-4-pieces-vue-mer",
"datePosted": "2025-01-01T00:00:00Z",
"offers": {
"@type": "Offer",
"price": 850000,
"priceCurrency": "EUR"
},
"floorSize": { "@type": "QuantitativeValue", "value": 120, "unitCode": "MTK" },
"numberOfBedrooms": 3,
"numberOfBathroomsTotal": 2,
"address": {
"@type": "PostalAddress",
"addressLocality": "Nice",
"postalCode": "06000",
"addressCountry": "FR"
},
"image": ["https://cdn.example.com/photo1.jpg"]
}