@extends('layouts.app') {{-- Story 5.5: Article JSON-LD structured data (only for published articles) --}} @if($article->isLive()) @section('json-ld') @endsection @endif @section('content') {{-- Preview banner — visible only when previewing unpublished content (Story 5.7) --}} @if(isset($preview) && $preview)
{{ __('blog.preview_banner') }} {{-- The preview opens in a new tab: close it when possible, otherwise go back to the editor --}} {{ __('blog.preview_exit') }}
@endif @php $locale = app()->getLocale(); // Parent section (blog or resources), provided by ShowsArticles; previews default to the blog $section = $section ?? ['name' => __('jsonld.breadcrumb.blog'), 'url' => localized_route('blog.index')]; $caseStudy = $article->type === \App\Enums\ArticleType::CaseStudy ? array_filter($article->case_study ?? []) : []; $headings = $headings ?? []; // Heading anchors computed once by the controller (duplicates get a suffix) $headingSlugs = collect($headings)->pluck('slug', 'block'); $coverUrl = $article->ogImageUrl(); $coverSize = storage_image_size('blog_images', $article->og_image); // Without a cover, the first image near the top is the LCP element: don't lazy-load it $eagerImageIndex = $coverUrl ? null : collect($article->blocks ?? [])->take(3)->search(fn ($b) => ($b['type'] ?? '') === 'image'); @endphp {{-- Breadcrumb --}} {{-- Article layout: content + sticky TOC sidebar (desktop) --}}
{{-- Main article content --}}
{{-- Article header --}}

{{ $article->title }}

@if($article->excerpt)

{{ $article->excerpt }}

@endif @if($article->tags->isNotEmpty())
@foreach($article->tags as $tag) {{ $tag->name }} @endforeach
@endif
{{-- Cover image (also the OG image) — LCP element --}} @if($coverUrl)
{{ $article->og_image_alt ?: '' }}
@endif {{-- Table of contents — mobile (the sticky one is desktop only) --}} @if(count($headings) > 1)
{{ __('blog.toc_title') }}
    @foreach($headings as $heading)
  1. {{ $heading['text'] }}
  2. @endforeach
@endif {{-- Case study key facts: client, site, results, deployed products --}} @if(!empty($caseStudy)) @endif {{-- Block rendering engine (Story 5.9) --}}
@if(!empty($article->blocks)) @foreach($article->blocks as $blockIndex => $block) @php $blockType = $block['type'] ?? ''; @endphp @switch($blockType) @case('paragraph') @break @case('heading') @php $headingData = $block['data'] ?? []; $headingData['slug'] = $headingSlugs[$blockIndex] ?? \Illuminate\Support\Str::slug($headingData['text'] ?? $headingData['content'] ?? ''); @endphp @break @case('image') @break @case('kpi') @break @case('quote') @break @case('banner') @break @case('button') @break @case('link') @break @case('video') @break @case('list') @break @case('classic') @break @case('gallery') @break @case('iframe') @break @default {{-- Unknown block type — graceful fallback --}} @if(isset($preview) && $preview)
Block type inconnu : {{ $blockType ?: 'N/A' }}
@else @endif @endswitch @endforeach @else

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

@endif
{{-- Call to action: the offer page linked to the article's tags, else contact --}} {{-- Author box (E-E-A-T) --}}
{{-- Sticky table of contents — desktop --}}
{{-- Related articles: same type, shared tags first --}} @if(isset($relatedArticles) && $relatedArticles->isNotEmpty())
@foreach($relatedArticles as $related) @endforeach
@endif @endsection