@extends('site.layouts.site-layout')

@section('title', 'تگ: ' . $tag->name . ' - وبلاگ')

@section('seo')
<meta name="description" content="مقالات وبلاگ با تگ {{ $tag->name }}">
<link rel="canonical" href="{{ url('blog/tags/' . $tag->slug) }}">
@endsection

@section('content')

<div class="bread-crumb pt-3">
    <div class="container-fluid">
        <div class="content-box">
            <div class="container-fluid">
                <nav aria-label="breadcrumb" class="my-lg-0 my-2">
                    <ol class="breadcrumb mb-0">
                        <li class="breadcrumb-item"><a href="{{ route('home') }}" class="font-14 text-muted">خانه</a></li>
                        <li class="breadcrumb-item"><a href="{{ route('blog.index') }}" class="font-14 text-muted">وبلاگ</a></li>
                        <li class="breadcrumb-item active main-color-one-color font-14" aria-current="page">تگ: {{ $tag->name }}</li>
                    </ol>
                </nav>
            </div>
        </div>
    </div>
</div>

<div class="content">
    <div class="container-fluid">
        <div class="row gy-3">
            <div class="col-lg-3">
                @include('site.blog.partials._sidebar')
            </div>

            <div class="col-lg-9">
                <div class="content-box mb-3">
                    <div class="container-fluid py-3">
                        <h1 class="font-20 mb-0">
                            <i class="bi bi-tag main-color-one-color"></i>
                            مقالات با تگ: {{ $tag->name }}
                        </h1>
                    </div>
                </div>

                <div class="gird-post-blog">
                    <div class="row gy-3">
                        @forelse($posts as $post)
                            <div class="col-lg-4 col-md-6">
                                @include('site.blog.partials._post-card', ['post' => $post])
                            </div>
                        @empty
                            <div class="col-12">
                                <div class="content-box text-center py-5 text-muted">
                                    <i class="bi bi-journal-x fs-1 d-block mb-3"></i>
                                    مقاله‌ای با این تگ پیدا نشد.
                                </div>
                            </div>
                        @endforelse
                    </div>

                    @if($posts->hasPages())
                        <div class="mt-4 d-flex justify-content-center">
                            {{ $posts->onEachSide(1)->links() }}
                        </div>
                    @endif
                </div>
            </div>
        </div>
    </div>
</div>

@endsection
