@forelse($posts as $index => $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/tb8.jpg'); $blogUrl = route('blog.show', $post->slug); $commentCount = $post->comments_count ?? 0; $authorName = $post->author ? $post->author->name : 'Trunçgil'; @endphp @if($index < 3) {{-- First 3 posts in Classic View --}}
@if($post->featured_image || $post->featured_image_url)
{{ $title }}
{{ __('blog.read_more') }}
@endif
@if($categoryName) @endif

{{ $title }}

{{ \Illuminate\Support\Str::limit(strip_tags($excerpt), 220) }}

@endif @empty

{{ __('blog.empty') }}

@endforelse
{{-- Subsequent posts in Grid View --}} @if($posts->count() > 3)
@foreach($posts as $index => $post) @if($index >= 3) @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); $authorName = $post->author ? $post->author->name : 'Trunçgil'; @endphp
@if($post->featured_image || $post->featured_image_url)
{{ $title }}
{{ __('blog.read_more') }}
@endif
@if($categoryName) @endif

{{ $title }}

{{ \Illuminate\Support\Str::limit(strip_tags($excerpt), 120) }}

@endif @endforeach
@endif {{-- Pagination --}} @if(method_exists($posts, 'links') && $posts->hasPages())
{{ $posts->links() }}
@endif