url('/'), 'lastmod' => now()->startOfDay()->toAtomString(), 'changefreq' => 'daily', 'priority' => '1.0', ]; $urls[] = [ 'loc' => route('blog.index'), 'lastmod' => now()->startOfDay()->toAtomString(), 'changefreq' => 'weekly', 'priority' => '0.8', ]; $urls[] = [ 'loc' => route('career.index'), 'lastmod' => now()->startOfMonth()->toAtomString(), 'changefreq' => 'monthly', 'priority' => '0.5', ]; // 2. Dynamic Pages $pages = Page::where('status', 'published') ->where('is_homepage', false) ->get(); foreach ($pages as $page) { $urls[] = [ 'loc' => url($page->slug), 'lastmod' => $page->updated_at->toAtomString(), 'changefreq' => 'weekly', 'priority' => '0.7', ]; } // 3. Blog Posts if (class_exists(Blog::class)) { $posts = Blog::published()->get(); foreach ($posts as $post) { $urls[] = [ 'loc' => route('blog.show', $post->slug), 'lastmod' => $post->updated_at->toAtomString(), 'changefreq' => 'weekly', 'priority' => '0.6', ]; } } // 4. Products if (class_exists(Product::class)) { $products = Product::where('is_active', true)->get(); foreach ($products as $product) { $urls[] = [ 'loc' => route('products.show', $product->slug), 'lastmod' => $product->updated_at->toAtomString(), 'changefreq' => 'weekly', 'priority' => '0.7', ]; } } return response()->view('sitemap', compact('urls')) ->header('Content-Type', 'text/xml'); } }