Browse Source

feat:sitemap

igb 4 months ago
parent
commit
f226881fd4
1 changed files with 18 additions and 10 deletions
  1. 18 10
      resources/views/sitemap/index.blade.php

+ 18 - 10
resources/views/sitemap/index.blade.php

@@ -8,17 +8,25 @@
         <priority>1.0</priority>
     </url>
 
-{{--    <!-- 产品列表 -->--}}
-{{--    @foreach ($products as $product)--}}
-{{--        <url>--}}
-{{--            <loc>{{ route('products.show', $product->id) }}</loc>--}}
-{{--            <lastmod>{{ $product->updated_at->toAtomString() }}</lastmod>--}}
-{{--            <changefreq>weekly</changefreq>--}}
-{{--            <priority>0.8</priority>--}}
-{{--        </url>--}}
-{{--    @endforeach--}}
-
+    <!-- 产品列表 -->
+    @foreach ($dist_products as $product)
+        <url>
+            <loc>{{ route('products.detail', $product->id) }}</loc>
+            <lastmod>{{ $product->updated_at->toAtomString() }}</lastmod>
+            <changefreq>weekly</changefreq>
+            <priority>0.8</priority>
+        </url>
+    @endforeach
 
 
+    <!-- 文章列表 -->
+    @foreach ($dist_pages as $page)
+        <url>
+            <loc>{{ $page->slug ? route('page.detail', $page->slug) : route('page.detail', $page->id) }}</loc>
+            <lastmod>{{ $page->updated_at->toAtomString() }}</lastmod>
+            <changefreq>weekly</changefreq>
+            <priority>0.8</priority>
+        </url>
+    @endforeach
 
 </urlset>