Browse Source

标签修改

moshaorui 3 weeks ago
parent
commit
0d3270c02b
1 changed files with 11 additions and 11 deletions
  1. 11 11
      app/Services/LiquidTags/LiquidTagCollection.php

+ 11 - 11
app/Services/LiquidTags/LiquidTagCollection.php

@@ -66,18 +66,18 @@ class LiquidTagCollection extends AbstractBlock
             return ''; // 如果没有找到页面,返回空字符串
         }
 
-//        $pagesData = [];
-//        $items = $pages->items();
-//        if ($items) {
-//            $i = 0;
-//            foreach ($items as $item) {
-//                $pagesData[$i] = $item;
-//                $pagesData[$i]['tags'] = $item->tags->toArray();
-//                $i++;
-//            }
-//        }
+        $pagesData = [];
+        $items = $pages->items();
+        if ($items) {
+            $i = 0;
+            foreach ($items as $item) {
+                $pagesData[$i] = $item;
+                $pagesData[$i]['tags'] = $item->tags->toArray();
+                $i++;
+            }
+        }
         // 如果有文章,渲染模板
-        return $this->renderTemplate(['pages' => $pages->items()]);
+        return $this->renderTemplate(['pages' => $pagesData]);
     }
 
     // 渲染模板