@extends('layouts.public')
@section('title', $listing->title)
@section('meta_description', Str::limit(strip_tags($listing->description ?? ''), 158))
@push('head')
@php
// Built in PHP rather than with @json: Blade reads an @-prefixed key
// inside a directive as a directive of its own.
$schema = array_filter([
'@context' => 'https://schema.org',
'@type' => 'Product',
'name' => $listing->title,
'description' => Str::limit(strip_tags($listing->description ?? ''), 300) ?: null,
'sku' => $listing->reference,
'image' => $listing->cover_image ? image_url($listing->cover_image) : null,
'offers' => array_filter([
'@type' => 'Offer',
'price' => $listing->price ? (string) ($listing->price / 100) : null,
'priceCurrency' => $listing->currency ?: config('marketplace.currency.default'),
'availability' => $listing->isLive()
? 'https://schema.org/InStock'
: 'https://schema.org/SoldOut',
'url' => $listing->publicUrl(),
]),
]);
@endphp
@endpush
@section('content')
@if ($images->isNotEmpty())
@if ($images->count() > 1)
@foreach ($images->take(6) as $image)
@endforeach
@endif
@endif
{{ $listing->intent->label() }}
@if ($listing->category)
{{ $listing->category->name }}
@endif
@if ($listing->status->isClosed())
{{ $listing->status->label() }}
@endif
{{ $listing->title }}
{{ $listing->locationLabel() }}
@if ($listing->description)
{{ __('Description') }}
{{ $listing->description }}
@endif
{{-- The specification is whatever the category declared. There is no
per-vertical view: a tractor and a phone render through the same
loop because the difference between them is data. --}}
@if ($specification !== [])
{{ __('Specification') }}
@foreach ($specification as $row)
{{ $row['label'] }}
{{ $row['value'] }}
@endforeach
@endif
@if ($related->isNotEmpty())
{{ __('More in :category', ['category' => $listing->category?->name]) }}
@foreach ($related as $other)
@include('public.partials.listing-card', ['listing' => $other, 'favouritedIds' => []])
@endforeach
@endif
{{ $listing->formattedPrice() }}
@if ($period = $listing->pricePeriodLabel())
{{ $period }}
@endif
{{ $listing->reference }}
{{-- A closed listing keeps its page but loses its form: an
enquiry about something already sold wastes both sides'
time. --}}
@if ($listing->isLive())
@include('public.properties.partials.enquiry-form', ['listing' => $listing])
@else
{{ __('This listing is no longer available.') }}
@endif
@if ($listing->seller)
@endif
@endsection