@extends("landingpage::themes.{$activeTheme}.layouts.app") @php // $page is passed from FrontendPageController @endphp @section('meta_title', $page->meta_title ?: $page->title) @section('meta_description', $page->meta_description ?: setting('landingpage_global_meta_description')) @section('meta_keywords', $page->meta_keywords ?: setting('landingpage_global_meta_keywords')) @push('schema_markup') @endpush @section('content') @php // Eager load sections if not already loaded if (!$page->relationLoaded('sections')) { $page->load('sections'); } $dynamicHeroSection = $page->sections->where('type', 'hero')->sortBy('sort_order')->first(); @endphp {{-- Attempt to render a dynamic hero section first --}} @if ($dynamicHeroSection && isset($dynamicHeroSection->content)) {{-- Fallback to default hero fields on the LpPage model if they exist and no dynamic hero section --}} @elseif ($page->hero_title)

{{ $page->hero_title }}

@if($page->hero_subtitle)

{{ $page->hero_subtitle }}

@endif @if($page->hero_cta_text && $page->hero_cta_link) {{ $page->hero_cta_text }} @endif
@else {{-- Standard Page Title if no hero section (dynamic or default) is present --}}

{{ $page->title }}

@endif {{-- Render other dynamic sections (excluding the hero if handled above) --}} @if($page->sections->where('type', '!=', 'hero')->count() > 0) @foreach ($page->sections->where('type', '!=', 'hero')->sortBy('sort_order') as $section) @if (isset($section->content)) @endif @endforeach @endif {{-- Main Page Content (from WYSIWYG) - Render if no dynamic sections OR if dynamic sections are meant to supplement it --}} {{-- If you want this content to always show, even with sections, remove the sections count check. --}} {{-- If sections replace this content, keep the check or adjust logic. --}} @if($page->content && ($page->sections->where('type', '!=', 'hero')->count() == 0 || setting('landingpage_render_main_content_with_sections', false)))
@if($page->featured_image_url && !$dynamicHeroSection && !$page->hero_title) {{-- Show featured image if no hero was rendered --}} {{ $page->title }} @endif
{!! $page->content !!}
@endif @endsection