@extends('layouts.app') @section('content') @php use Illuminate\Support\Str; $locale = app()->getLocale(); $dir = $locale === 'ar' ? 'rtl' : 'ltr'; // Préparer les données pour le partage $shareUrl = url()->current(); $shareTitle = function_exists('trans_field') ? trans_field($news, 'title') : ($news->title ?? ($news->titre_G ?? 'Actualité')); $shareDescription = Str::limit(strip_tags(function_exists('trans_field') ? trans_field($news, 'content') : ($news->content ?? '')), 160); $shareImage = $imageSrc ?? asset('assets/img/logo/logo2.png'); @endphp
{{-- En-tête --}}
{{ \Carbon\Carbon::parse($news->date)->format('d/m/Y') }}

{{-- title: try trans_field (titre_fr/titre_ar), fallback to plain title --}}

{{ $shareTitle }}

{{-- pour équilibrer le centrage --}}
{{-- Contenu principal --}}
{{-- Image ou vidéo --}}
@if(!empty($imageSrc)) {{ $shareTitle }} @elseif(!empty($news->youtube_url)) @php preg_match('/(youtu\.be\/|v=)([A-Za-z0-9_\-]+)/', $news->youtube_url, $matches); $youtubeId = $matches[2] ?? null; @endphp @if($youtubeId)
@endif @endif
{{-- Texte du contenu --}}
{{-- content: prefer localized content field if available --}} @if(function_exists('trans_field')) {!! trans_field($news, 'content') ?? $news->content !!} @else {!! $news->content !!} @endif
{{-- Section de partage social --}} {{-- Bouton retour --}}
{{-- Popup de notification personnalisée --}}
{{ __('site.lien_copie') ?? 'Lien copié avec succès !' }}
@endsection