@extends('frontend.layouts.app') @php /* ---------- SEO values ---------- */ $seoTitle = trim((string) ($page->meta_title ?: $page->title)); $seoDesc = $page->seoDescription(); $seoKeys = trim((string) $page->meta_keywords); $seoImg = $page->ogImageUrl(); $seoUrl = $page->canonicalUrl(); $robots = $page->robotsContent(); $schema = (string) ($page->schema_type ?: 'WebPage'); $isArticle = in_array($schema, ['Article', 'BlogPosting'], true); /* Safe for HTML attribute context (@yield is not escaped by Blade). */ $attr = fn ($s) => str_replace(['&', '"'], ['&', '"'], (string) $s); /* Safe for element content (the tag). */ $elem = fn ($s) => str_replace(['&', '<', '>'], ['&', '<', '>'], (string) $s); /* ---------- JSON-LD structured data ---------- */ $jsonld = [ '@context' => 'https://schema.org', '@type' => $schema, 'name' => $page->title, 'description' => $seoDesc, 'url' => $seoUrl, 'inLanguage' => 'en', 'isPartOf' => [ '@type' => 'WebSite', 'name' => 'The Braj Dham Seva Trust', 'url' => url('/'), ], 'publisher' => [ '@type' => 'Organization', 'name' => 'The Braj Dham Seva Trust', 'logo' => [ '@type' => 'ImageObject', 'url' => asset('images/logo/the-braj-logo.jpg'), ], ], 'datePublished' => optional($page->created_at)->toIso8601String(), 'dateModified' => optional($page->updated_at)->toIso8601String(), ]; if ($isArticle) { $jsonld['headline'] = $page->title; $jsonld['mainEntityOfPage'] = ['@type' => 'WebPage', '@id' => $seoUrl]; } if ($seoImg) { $jsonld['image'] = $seoImg; } @endphp {{-- ---- Page-level SEO meta ---- --}} @section('title', $elem($seoTitle) . ' - The Braj Dham Seva Trust') @section('meta_description', $attr($seoDesc)) @section('og_title', $attr($seoTitle)) @section('og_description', $attr($seoDesc)) @section('og_url', $attr($seoUrl)) @section('og_type', $isArticle ? 'article' : 'website') @section('robots', $attr($robots)) @section('canonical', $attr($seoUrl)) @if($seoKeys !== '') @section('meta_keywords', $attr($seoKeys)) @endif @if($seoImg) @section('og_image', $attr($seoImg)) @endif @section('jsonld') <script type="application/ld+json">{!! json_encode($jsonld, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) !!}</script> @endsection @section('content') <section style="background:linear-gradient(180deg,#1B140F 0%,#F2B622 100%);padding:80px 0 48px;text-align:center;"> <div class="container" style="max-width:800px;"> <h1 style="font-family:'Cormorant Garamond',serif;font-size:38px;font-weight:600;color:var(--text-primary);margin:0;">{{ $page->title ?? 'Page' }}</h1> </div> </section> <article style="padding:48px 0 80px;"> <div class="container" style="max-width:800px;"> <div style="font-size:16px;line-height:1.8;color:var(--text-primary);"> {!! $page->content ?? '' !!} </div> </div> </article> @endsection