Best Way to Add Schema Markup for Real Estate in Laravel?


I’m working on a Laravel-based property website and exploring the best way to add schema markup for real estate listings. Schema helps Google understand property details such as price, location, and availability, and can make listings eligible for rich snippets.

As an example of a Laravel-powered real estate site, you can look at Danvast Property.




Simple Approach I Tried

In my project, I embedded JSON-LD directly into the property detail Blade template:

Enter fullscreen mode

Exit fullscreen mode

php

{
@context“: “https://schema.org“,
“@type”: “Offer”,
“itemOffered”: {
“@type”: “Apartment”,
“name”: “{{ $property->title }}”,
“address”: {
“@type”: “PostalAddress”,
“streetAddress”: “{{ $property->address }}”,
“addressLocality”: “{{ $property->city }}”
}
},
“priceCurrency”: “USD”,
“price”: “{{ $property->price }}”,
“availability”: “https://schema.org/{{ $property->status == ‘available’ ? ‘InStock’ : ‘SoldOut’ }}”,
“url”: “{{ route(‘property.show’, $property->slug) }}”
}

Enter fullscreen mode

Exit fullscreen mode

This method is simple: just use Blade variables to inject dynamic property data into the JSON-LD.



Discussion Points

  • Is embedding schema directly into the Blade view considered best practice?
  • Would it be better to create a reusable Blade component for schema markup?
  • Has anyone here used a package or SEO helper to manage structured data at scale in Laravel projects?



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *