// Dynamic SEO & GSO (Generative Search Optimization) Head Renderer function renderSeoHead(array $meta = [], array $products = []): void { $baseUrl = 'https://iambuying.today'; $title = $meta['title'] ?? 'iambuying.today — A Little Bird Told Me Where the Best Finds Are Hiding'; $description = $meta['description'] ?? 'A little bird told me where the best deals and merch are hiding across Amazon, Walmart, Temu, Best Buy, and Digistore24. Browse curated tech gadgets, home hacks, road gear, and cool finds.'; $canonical = $meta['canonical'] ?? $baseUrl . strtok($_SERVER['REQUEST_URI'] ?? '/', '?'); $ogImage = $meta['image'] ?? $baseUrl . '/assets/logo.png'; $robots = $meta['robots'] ?? 'index, follow, max-image-preview:large'; // Core WebSite Schema for AI & Search Entity Recognition $schemas = [ [ '@context' => 'https://schema.org', '@type' => 'WebSite', 'name' => 'iambuying.today', 'alternateName' => 'A Little Bird Told Me', 'url' => $baseUrl . '/', 'description' => $description, 'potentialAction' => [ '@type' => 'SearchAction', 'target' => $baseUrl . '/index.php?q={search_term_string}', 'query-input' => 'required name=search_term_string', ], ] ]; // If product cards are passed, emit a clean ItemList schema (no static prices) if (!empty($products)) { $listItems = []; foreach (array_slice($products, 0, 25) as $idx => $item) { $listItems[] = [ '@type' => 'ListItem', 'position' => $idx + 1, 'item' => [ '@type' => 'Product', 'name' => $item['title'], 'description' => $item['bird_note'], 'image' => str_starts_with($item['image_url'], 'http') ? $item['image_url'] : $baseUrl . '/' . ltrim($item['image_url'], '/'), 'category' => $item['category_name'] ?? 'Curated Finds', 'brand' => [ '@type' => 'Brand', 'name' => $item['network'], ], ], ]; } $schemas[] = [ '@context' => 'https://schema.org', '@type' => 'ItemList', 'name' => $title, 'numberOfItems' => count($listItems), 'itemListElement' => $listItems, ]; } echo '' . htmlspecialchars($title) . "\n"; echo '\n"; echo '\n"; echo '\n"; // Open Graph (Pinterest, Facebook, LinkedIn) echo '' . "\n"; echo '' . "\n"; echo '\n"; echo '\n"; echo '\n"; echo '\n"; // Twitter / X Summary Card echo '' . "\n"; echo '\n"; echo '\n"; echo '\n"; // JSON-LD Structured Data for Search & Generative AI Engines foreach ($schemas as $schema) { echo '\n"; } }