sark 1 mēnesi atpakaļ
vecāks
revīzija
073fa0cee4
1 mainītis faili ar 35 papildinājumiem un 12 dzēšanām
  1. 35 12
      resources/view/partials/schema.php

+ 35 - 12
resources/view/partials/schema.php

@@ -74,7 +74,7 @@ $schemaGraph[] = $casinoBrand;
 $schemaGraph[] = [
     "@type" => "WebSite",
     "url" => $currentDomain,
-    "name" => $settingsContent['title-h1'],
+    "name" => $seo['title'] ?? $pageData['title'],
     "publisher" => [
         "@id" => $currentUrl . "#organization"
     ]
@@ -144,7 +144,7 @@ $schemaGraph[] = [
         [
             "@type" => "ListItem",
             "position" => 1,
-            "name" => $settingsJsonld['breadcrumb_home_name'] ?? $settingsContent['title-h1'],
+            "name" => $settingsJsonld['breadcrumb_home_name'] ?? ($seo['title'] ?? $pageData['title']),
             "item" => $currentUrl
         ]
     ]
@@ -152,13 +152,12 @@ $schemaGraph[] = [
 
 // 8. FAQPage
 if (!empty($faqItems)) {
-    $schemaGraph[] = [
-        "@type" => "FAQPage",
-        "mainEntityOfPage" => [
-            "@id" => $currentUrl . "#webpage"
-        ],
-        "mainEntity" => array_map(function ($item) {
-            return [
+    $faqQuestions = [];
+    foreach ($faqItems as $item) {
+        // Support both formats: content FAQ (question/answer) and pages FAQ (extra_fields)
+        if (isset($item['question']) && isset($item['answer'])) {
+            // Content FAQ format
+            $faqQuestions[] = [
                 "@type" => "Question",
                 "name" => htmlspecialchars($item['question']),
                 "acceptedAnswer" => [
@@ -166,8 +165,32 @@ if (!empty($faqItems)) {
                     "text" => htmlspecialchars($item['answer'])
                 ]
             ];
-        }, $faqItems)
-    ];
+        } elseif (isset($item['extra_fields']) && is_array($item['extra_fields'])) {
+            // Pages FAQ format - check extra_fields
+            foreach ($item['extra_fields'] as $faqItem) {
+                if (isset($faqItem['question']) && isset($faqItem['answer'])) {
+                    $faqQuestions[] = [
+                        "@type" => "Question",
+                        "name" => htmlspecialchars($faqItem['question']),
+                        "acceptedAnswer" => [
+                            "@type" => "Answer",
+                            "text" => htmlspecialchars($faqItem['answer'])
+                        ]
+                    ];
+                }
+            }
+        }
+    }
+    
+    if (!empty($faqQuestions)) {
+        $schemaGraph[] = [
+            "@type" => "FAQPage",
+            "mainEntityOfPage" => [
+                "@id" => $currentUrl . "#webpage"
+            ],
+            "mainEntity" => $faqQuestions
+        ];
+    }
 }
 
 // 9. SoftwareApplication (if app fields are filled)
@@ -175,7 +198,7 @@ if (!empty($settingsJsonld['download_url']) || !empty($settingsJsonld['app_name'
     $schemaGraph[] = [
         "@type" => "SoftwareApplication",
         "@id" => $currentUrl . "#app",
-        "name" => $settingsJsonld['app_name'] ?? ($settingsContent['title-h1'] . " App"),
+        "name" => $settingsJsonld['app_name'] ?? (($seo['title'] ?? $pageData['title']) . " App"),
         "operatingSystem" => $settingsJsonld['operating_system'] ?? "Android, iOS",
         "applicationCategory" => $settingsJsonld['application_category'] ?? "GameApplication",
         "provider" => [