{{ $news->summary }}
@elseif($news->subtitle){{ $news->subtitle }}
@elseNenhum conteúdo disponível.
@endif@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 --}}
{{-- ================================================================ --}}
{{ $news->summary }} {{ $news->subtitle }} Nenhum conteúdo disponível. {{ $news->source }}{{ $news->title }}
{{-- Badge de origem (API de regional) --}}
@if($isFromApi)
@if(isset($news->unidadeRegional) && $news->unidadeRegional && strtolower($news->unidadeRegional->acronym) !== 'nac')
{{ $news->unidadeRegional->name }}
@endif
Galeria de Imagens
Notícias Relacionadas