{{-- resources/views/wiki/page.blade.php --}} @php $meta = $meta ?? []; $tabTitle = $meta['name'] ?? $meta['title'] ?? null; if (!$tabTitle) { $sec = isset($section) ? ucfirst(str_replace('-', ' ', (string) $section)) : 'Wiki'; $slg = isset($slug) ? ucfirst(str_replace('-', ' ', (string) $slug)) : ''; $tabTitle = trim($sec . ($slg ? ' / ' . $slg : '')); } $rawDesc = $meta['description'] ?? $meta['summary'] ?? ''; if (is_array($rawDesc)) { $rawDesc = implode(' ', array_filter(array_map('trim', $rawDesc))); } $seoDescription = trim((string) $rawDesc); if ($seoDescription === '') { $seoDescription = 'Learn more about ' . $tabTitle . ' on the Vortex Sky X Wiki.'; } $seoTitle = $tabTitle . ' • Vortex Sky X Wiki'; $icon = (string) ($meta['icon'] ?? ''); $seoImage = $icon !== '' ? (str_starts_with($icon, 'http') ? $icon : url($icon)) : asset('images/WebLogo.png'); @endphp {{ $seoTitle }} @include('wiki.partials.seo', [ 'title' => $seoTitle, 'description' => $seoDescription, 'image' => $seoImage, 'type' => 'article', 'game' => $game ?? null, ]) @vite(['resources/css/app.css', 'resources/js/app.js']) @include('wiki.partials.header', ['databaseMenu' => $databaseMenu]) @php $isItemDetail = (isset($section) && strtolower((string) $section) === 'items') && !empty($category) && !empty($slug); $entityName = $meta['name'] ?? $meta['title'] ?? null; $icon = $meta['icon'] ?? null; $rar = strtolower((string) ($meta['rarity'] ?? '')); $rarClass = $rar ? 'wk-q-' . $rar : ''; $fac = (string) ($meta['faction'] ?? ''); $facClass = $fac ? 'wk-f-' . strtolower($fac) : ''; $lvl = $meta['level_requirement'] ?? null; $stats = $meta['stats'] ?? []; $effects = $meta['effects'] ?? []; $sources = $meta['sources'] ?? []; // Description can be a string or a list (array) $desc = $meta['description'] ?? null; $descLines = []; if (is_array($desc)) { $descLines = array_values(array_filter(array_map('trim', $desc))); } elseif (is_string($desc) && trim($desc) !== '') { $descLines = [trim($desc)]; } $pageTitle = $isItemDetail ? ($entityName ?? 'Item Details') : ($meta['title'] ?? ucfirst(str_replace('-', ' ', (string) ($slug ?? '')))); // Only strip duplicate H1/img on item detail pages (never on home) $renderHtml = $html ?? ''; if ($isItemDetail) { $renderHtml = preg_replace('/]*>.*?<\/h1>\s*/is', '', $renderHtml, 1); $renderHtml = preg_replace('/

\s*]*>\s*<\/p>\s*/is', '', $renderHtml, 1); $renderHtml = preg_replace('/]*>\s*]*>\s*(?:]*>.*?<\/figcaption>\s*)?<\/figure>\s*/is', '', $renderHtml, 1); } $modelUrl = $meta['model_url'] ?? null; $typeLabel = $meta['type'] ?? null; $modelAllowed = ['npcs', 'monsters', 'weapons', 'armors', 'boots', 'capes']; // Prefer frontmatter "category" if present, otherwise fall back to "type" $modelKeyRaw = $meta['category'] ?? ($meta['type'] ?? ''); $modelKey = strtolower(trim((string) $modelKeyRaw)); $allowModelButton = in_array($modelKey, $modelAllowed, true); @endphp

@if($isItemDetail)
@if($icon) {{ $entityName ?? $pageTitle }} @endif
@if($allowModelButton) @endif
@if($entityName)
{{ $entityName }}
@endif
@if($fac)
{{ $fac }}
@endif @if($lvl !== null && $lvl !== '')
Req. Lv: {{ (int) $lvl }}
@endif @if(!empty($typeLabel))
Type: {{ ucfirst(str_replace('-', ' ', (string) $typeLabel)) }}
@endif
@if(count($descLines))
Description:
@foreach($descLines as $line)
{{ $line }}
@endforeach
@endif @if(is_array($stats) && count($stats))
@foreach($stats as $k => $v)
{{ str_replace('_', ' ', ucfirst((string) $k)) }} {{ $v }}
@endforeach
@endif @if(is_array($effects) && count($effects))
Effects
    @foreach($effects as $e)
  • {{ $e }}
  • @endforeach
@endif @if(is_array($sources) && count($sources))
Sources
    @foreach($sources as $s)
  • {{ $s }}
  • @endforeach
@endif
@endif {{-- Markdown content (home carousels live here) --}}
{!! $renderHtml !!}
@if($isItemDetail) @endif