@forelse($posts as $post)
@php
$title = method_exists($post, 'translate') ? $post->translate('title') : $post->title;
$excerpt = method_exists($post, 'translate') ? $post->translate('excerpt') : ($post->excerpt ?? '');
$categoryName = $post->category ? $post->category->name : '';
$categorySlug = $post->category ? $post->category->slug : '';
$publishedDate = $post->published_at ? $post->published_at->format('d M Y') : $post->created_at->format('d M Y');
$imageUrl = $post->featured_image ? asset('storage/' . $post->featured_image) : asset('assets/img/photos/tb10.jpg');
$blogUrl = route('blog.show', $post->slug);
$colorMap = [
'teknoloji-cozumleri' => '#54a8c7', // Blue
'yapay-zeka' => '#f78b77', // Coral/Red
'muzik-teknolojileri' => '#fab758', // Yellow
'uygulama-gelistirme' => '#7cb798', // Mint/Green
];
$catColor = $colorMap[$categorySlug] ?? '#d16b86'; // default Elemis rose/pink
// Comment count logic
$commentCount = $post->comments_count ?? ($post->comments ? $post->comments->count() : 0);
// Dynamic heart likes count scaled off view_count
$likesCount = max(3, round(($post->view_count ?? 0) * 0.1) + ($post->id % 5));
@endphp
@if($post->featured_image || $post->featured_image_url)
{{ __('blog.read_more') }}
@endif
{{ \Illuminate\Support\Str::limit(strip_tags($excerpt), 160) }}
@empty
@endforelse
{{-- Dynamic Custom Pagination --}}
@if(method_exists($posts, 'links') && $posts->hasPages())