@php /** @var \V2\Modules\Publicacoes\Noticias\Models\News $news */ /** @var string $htmlContent */ /** @var \Illuminate\Support\Collection $related */ $previewMode = isset($previewMode) && $previewMode ? true : false; $seoData = $news->getSeoData(); $pageTitle = $previewMode ? '[Preview] ' . $news->title : $news->title; $metaDescription = strip_tags($seoData['description'] ?? ($news->subtitle ?? $news->summary ?? '')); $metaImage = $news->getCoverImageUrl(); $authorName = $news->author ? ($news->author->name ?? $news->author->email ?? '') : ($news->responsible_name ?? ''); $isFromApi = ($news->metadata['source'] ?? '') === 'api'; $monthsPt = ['JAN', 'FEV', 'MAR', 'ABR', 'MAI', 'JUN', 'JUL', 'AGO', 'SET', 'OUT', 'NOV', 'DEZ']; @endphp @push('head-styles') @endpush @php // Palavras-chave a partir das tags $keywords = ''; if ($news->relationLoaded('tags') && $news->tags->count() > 0) { $keywords = $news->tags->pluck('name')->implode(', '); } // Contagem aproximada de palavras (do conteúdo e subtítulo) $wordCount = 0; if (!empty($htmlContent)) { $wordCount = str_word_count(strip_tags($htmlContent)); } elseif (!empty($news->summary)) { $wordCount = str_word_count($news->summary); } elseif (!empty($news->subtitle)) { $wordCount = str_word_count($news->subtitle); } // URL canônica da página $pageUrl = request()->url(); // Itens da galeria para hasPart $hasParts = []; if ($news->relationLoaded('gallery') && $news->gallery->count() > 0) { foreach ($news->gallery as $galleryMedia) { $captionAlt = $galleryMedia->alt_text; if (empty($captionAlt) || preg_match('/\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?|pdf)$/i', $captionAlt)) { $captionAlt = $galleryMedia->description ?: 'Imagem da galeria'; } $hasParts[] = [ '@type' => 'ImageObject', 'contentUrl' => v2_storage_url($galleryMedia->file_path), 'caption' => $captionAlt, ]; } } // Adiciona a imagem de capa como primeiro hasPart se existir if ($metaImage) { array_unshift($hasParts, [ '@type' => 'ImageObject', 'contentUrl' => $metaImage, 'caption' => $news->getCoverImageAlt(), ]); } $schemas = [ [ '@context' => 'https://schema.org', '@type' => 'NewsArticle', 'headline' => $news->title, 'description' => $metaDescription, 'image' => $metaImage ?: [], 'thumbnailUrl' => $metaImage, 'datePublished' => $news->published_at ? $news->published_at->toIso8601String() : $news->created_at->toIso8601String(), 'dateModified' => $news->updated_at->toIso8601String(), 'wordCount' => $wordCount, 'isAccessibleForFree' => true, 'inLanguage' => 'pt-BR', 'mainEntityOfPage' => [ '@type' => 'WebPage', '@id' => $pageUrl, ], 'author' => [ '@type' => 'Organization', 'name' => $isFromApi ? ($news->metadata['source_unidade_regional_name'] ?? config('app.name')) : config('app.name'), 'url' => $isFromApi && !empty($news->metadata['source_unidade_regional_slug']) ? url('/regional/' . $news->metadata['source_unidade_regional_slug']) : url('/'), ], 'publisher' => [ '@type' => 'Organization', 'name' => config('app.name'), 'url' => url('/'), 'logo' => [ '@type' => 'ImageObject', 'url' => url('/assets/images/logo.png'), ], ], 'copyrightYear' => ($news->published_at ? $news->published_at->year : $news->created_at->year), 'copyrightHolder' => [ '@type' => 'Organization', 'name' => config('app.name'), ], ], ]; // Categoria como articleSection if ($news->category) { $schemas[0]['articleSection'] = $news->category->name; } // Tags como keywords if (!empty($keywords)) { $schemas[0]['keywords'] = $keywords; } // about a partir das tags if ($news->relationLoaded('tags') && $news->tags->count() > 0) { foreach ($news->tags as $tag) { $schemas[0]['about'][] = [ '@type' => 'Thing', 'name' => $tag->name, ]; } } // Galeria como hasPart if (!empty($hasParts)) { $schemas[0]['hasPart'] = $hasParts; } if ($isFromApi) { $schemas[0]['provider'] = [ '@type' => 'Organization', 'name' => $news->metadata['source_unidade_regional_name'] ?? 'Regional SUCESU', '@id' => $news->metadata['source_unidade_regional_slug'] ?? '', ]; } @endphp @extends('v2-portal::app-layout', [ 'pageTitle' => $pageTitle, 'pageDescription' => str_limit($metaDescription, 160), 'coverImage' => $metaImage, 'gtag' => ['page_context' => 'noticia'], 'schemas' => $schemas, 'showAccessibilityBar' => true, 'stickyAccessibilityBar'=> false, 'showHeader' => true, 'showMainHeader' => false, 'showMainFooter' => true, 'showFooter' => true, 'showMainLeftArea' => false, 'showMainRightArea' => false, 'fullWidthMain' => true, ]) @section('main-section-area') {{-- ================================================================ --}} {{-- BREADCRUMB COMPACTO + TÍTULO --}} {{-- ================================================================ --}}
{{-- ================================================================ --}} {{-- CONTEÚDO + SIDEBAR --}} {{-- ================================================================ --}}
Pular para o conteúdo da notícia {{-- Preview mode alert --}} @if($previewMode) @endif

{{ $news->title }}

{{-- Badge de origem (API de regional) --}} @if($isFromApi) @endif {{-- Imagem de capa --}} @if($news->cover_image_id && $news->coverImage)
@include('v2-service-media::components.picture', [ 'originalPath' => $news->coverImage->file_path, 'variants' => $news->getCoverImageVariants(), 'alt' => $news->getCoverImageAlt(), 'class' => 'news-article__cover-img', 'lazy' => false, ]) @if(isset($news->unidadeRegional) && $news->unidadeRegional && strtolower($news->unidadeRegional->acronym) !== 'nac') {{ $news->unidadeRegional->name }} @endif
@elseif($metaImage)
{{ $news->getCoverImageAlt() }} @if(isset($news->unidadeRegional) && $news->unidadeRegional && strtolower($news->unidadeRegional->acronym) !== 'nac') {{ $news->unidadeRegional->name }} @endif
@endif {{-- Link para a regional --}} @if(isset($news->unidadeRegional) && $news->unidadeRegional && strtolower($news->unidadeRegional->acronym) !== 'nac') @endif {{-- Metadados --}} {{-- Corpo do artigo --}}
@if(!empty($htmlContent)) @include('v2-service-contentricheditor::components.partials.viewer-styles')
{!! $htmlContent !!}
@elseif($news->summary)

{{ $news->summary }}

@elseif($news->subtitle)

{{ $news->subtitle }}

@else

Nenhum conteúdo disponível.

@endif
{{-- Fonte --}} @if($news->source)
Fonte:

{{ $news->source }}

@endif {{-- Tags --}} @if($news->relationLoaded('tags') && $news->tags->count() > 0) @endif {{-- Galeria de Imagens --}} @if($news->relationLoaded('gallery') && $news->gallery->count() > 0) @php /** Função para detectar se texto é nome de arquivo */ $isFilename = function($text) { return !empty($text) && (bool) preg_match('/\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?|pdf)$/i', $text); }; $galleryItems = $news->gallery->map(function($m) use ($isFilename) { $alt = $m->alt_text; if (empty($alt) || $isFilename($alt)) { $alt = 'Imagem da galeria'; } $variants = !empty($m->variants) ? json_decode($m->variants, true) : []; return [ 'src' => v2_storage_url($m->file_path), 'path' => $m->file_path, 'variants' => is_array($variants) ? $variants : [], 'alt' => $alt, ]; })->values()->toArray(); @endphp

Galeria de Imagens

@endif
{{-- Notícias Relacionadas (grid no final do conteúdo) --}} @if(isset($related) && $related->count() > 0)

Notícias Relacionadas

@foreach($related->take(3) as $rel) @php $relExcerpt = $rel->summary ?: ($rel->subtitle ?: ''); @endphp
@endforeach
@endif {{-- Voltar --}}
{{-- /col-lg-8 --}} {{-- ============================================================ --}} {{-- SIDEBAR — Notícias em Destaque --}} {{-- ============================================================ --}}
{{-- /row --}}
{{-- ================================================================ --}} {{-- MODAL DA GALERIA DE IMAGENS --}} {{-- ================================================================ --}} @if($news->relationLoaded('gallery') && $news->gallery->count() > 0) @endif @endsection @push('head-styles') @endpush @push('scripts') @if($news->relationLoaded('gallery') && $news->gallery->count() > 0) @endif @endpush