Files
ahrommag/resources/views/sitemap/newscategory.blade.php
2025-11-16 12:43:07 +03:30

22 lines
947 B
PHP

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@if (count($categories) > 0)
@foreach ($categories as $category)
@if ($category->parent_id != null)
@php
$categoryparent = App\Models\Category::where('id', $category->parent_id)->first();
@endphp
<url>
<loc>{{ url('category/' . $categoryparent->slug . '/' . $category->slug).'/' }}</loc>
<lastmod>{{ $category->updated_at->setTimezone('Asia/Tehran')->toAtomString() }}</lastmod>
</url>
@endif
@if ($category->parent == 1)
<url>
<loc>{{ url('category/' . $category->slug).'/' }}</loc>
<lastmod>{{ $category->updated_at->setTimezone('Asia/Tehran')->toAtomString() }}</lastmod>
</url>
@endif
@endforeach
@endif
</urlset>