@extends('layouts.nova')
@push('head')
{{ $meta['title'] }}
@if(!empty($meta['og_image']))
@if(!empty($meta['og_width']))
@endif
@if(!empty($meta['og_height']))
@endif
@endif
@if(!empty($meta['og_image']))
@endif
@php
$authorName = $artwork->user?->name ?: $artwork->user?->username ?: null;
$keywords = $artwork->tags->pluck('name')->merge($artwork->categories->pluck('name'))->filter()->unique()->implode(', ');
$license = $artwork->license_url ?? null;
$imageObject = [
'@context' => 'https://schema.org',
'@type' => 'ImageObject',
'name' => html_entity_decode((string) $artwork->title, ENT_QUOTES | ENT_HTML5, 'UTF-8'),
'description' => html_entity_decode((string) ($artwork->description ?? ''), ENT_QUOTES | ENT_HTML5, 'UTF-8'),
'url' => $meta['canonical'],
'contentUrl' => $meta['og_image'] ?? null,
'thumbnailUrl' => $presentMd['url'] ?? ($meta['og_image'] ?? null),
'encodingFormat' => 'image/webp',
'width' => !empty($meta['og_width']) ? (int) $meta['og_width'] : null,
'height' => !empty($meta['og_height']) ? (int) $meta['og_height'] : null,
'author' => $authorName ? ['@type' => 'Person', 'name' => $authorName] : null,
'datePublished' => optional($artwork->published_at)->toAtomString(),
'license' => $license,
'keywords' => $keywords !== '' ? $keywords : null,
];
$creativeWork = [
'@context' => 'https://schema.org',
'@type' => 'CreativeWork',
'name' => html_entity_decode((string) $artwork->title, ENT_QUOTES | ENT_HTML5, 'UTF-8'),
'description' => html_entity_decode((string) ($artwork->description ?? ''), ENT_QUOTES | ENT_HTML5, 'UTF-8'),
'url' => $meta['canonical'],
'author' => $authorName ? ['@type' => 'Person', 'name' => $authorName] : null,
'datePublished' => optional($artwork->published_at)->toAtomString(),
'license' => $license,
'keywords' => $keywords !== '' ? $keywords : null,
'image' => $meta['og_image'] ?? null,
];
$imageObject = array_filter($imageObject, static fn ($value) => $value !== null && $value !== '');
$creativeWork = array_filter($creativeWork, static fn ($value) => $value !== null && $value !== '');
$preloadSrcset = ($presentMd['url'] ?? '') . ' 640w, ' . ($presentLg['url'] ?? '') . ' 1280w, ' . ($presentXl['url'] ?? '') . ' 1920w';
@endphp
@if(!empty($presentLg['url']))
@endif
@endpush
@section('content')
@vite(['resources/js/Pages/ArtworkPage.jsx'])
@endsection