{{-- resources/views/noticias/show.blade.php --}} {{ $noticia->titulo }} - Silfer Academia {{-- Scrollbar sutil para el panel lateral --}} {{-- Barra lateral --}} @include('header') @php use Illuminate\Support\Str; use Illuminate\Support\Facades\Storage; // Imagen principal (URL absoluta) $imgPath = $noticia->imagen ?: 'images/no-photo.jpg'; $img = Str::startsWith($imgPath, ['http://','https://']) ? $imgPath : asset(ltrim($imgPath, '/')); // Aspect ratio e info para reservar espacio (mejor CLS) $aspect = '16 / 9'; $imgWidth = 1600; $imgHeight = 900; // fallback try { $path = parse_url($img, PHP_URL_PATH); $local = public_path($path ?? ''); if ($path && file_exists($local)) { [$iw, $ih] = @getimagesize($local) ?: [0,0]; if ($iw && $ih) { $aspect = $iw.' / '.$ih; $imgWidth = $iw; $imgHeight = $ih; } } } catch (\Throwable $e) { /* ignore */ } $fecha = $noticia->fecha?->locale('es')->translatedFormat('j \\d\\e F, Y'); $lead = Str::limit(strip_tags($noticia->descripcion ?? ''), 260); // Documento PDF $docRaw = $noticia->documento ?? null; $docUrl = null; $docExists = false; if ($docRaw) { if (Str::startsWith($docRaw, ['http://','https://'])) { $docUrl = $docRaw; $docExists = true; } elseif (Str::startsWith($docRaw, 'storage/')) { $docUrl = asset($docRaw); $docExists = file_exists(public_path($docRaw)); } elseif (Str::startsWith($docRaw, 'public/')) { $docUrl = asset(Storage::url($docRaw)); $docExists = Storage::exists($docRaw); } else { $docUrl = asset(ltrim($docRaw, '/')); $docPath = parse_url($docUrl, PHP_URL_PATH); $docExists = $docPath ? file_exists(public_path($docPath)) : false; } } // Flag final para renderizar el bloque Documento $hasDoc = $docUrl && $docExists; // Para JSON-LD $published = optional($noticia->fecha)->toDateString(); @endphp {{-- JSON-LD mínimo para SEO de la noticia --}}

{{ $noticia->titulo }}

@if ($lead)

{{ $lead }}

@endif
@if ($fecha)
{{ $fecha }}
@endif
{{-- IMAGEN PRINCIPAL — sin recorte, ocupando el ancho por proporción --}}
{{ $noticia->titulo }}
{{-- Documento (PDF) - Se muestra solo si existe --}} @if ($hasDoc)

Documento

@endif
{{-- ========= OTRAS NOTICIAS ========= --}} {{-- ======== /OTRAS NOTICIAS ========= --}}
@include('footer')