Initial commit
This commit is contained in:
39
resources/views/sitemap/index.blade.php
Normal file
39
resources/views/sitemap/index.blade.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<sitemap>
|
||||
<loc>{{ url('page.xml').'/' }}</loc>
|
||||
</sitemap>
|
||||
<sitemap>
|
||||
<loc>{{ url('post-category.xml').'/' }}</loc>
|
||||
</sitemap>
|
||||
<sitemap>
|
||||
<loc>{{ url('news-category.xml').'/' }}</loc>
|
||||
</sitemap>
|
||||
@if ($countNews > 0)
|
||||
@for ($i = 0; $i < $news; $i++)
|
||||
@if ($i == 0)
|
||||
<sitemap>
|
||||
<loc>{{ url('news.xml').'/' }}</loc>
|
||||
</sitemap>
|
||||
@else
|
||||
<sitemap>
|
||||
<loc>{{ url('news' . $i + 1 . '.xml').'/' }}</loc>
|
||||
</sitemap>
|
||||
@endif
|
||||
@endfor
|
||||
@endif
|
||||
|
||||
@if ($countBlogs > 0)
|
||||
@for ($i = 0; $i < $blogs; $i++)
|
||||
@if ($i == 0)
|
||||
<sitemap>
|
||||
<loc>{{ url('post.xml').'/' }}</loc>
|
||||
</sitemap>
|
||||
@else
|
||||
<sitemap>
|
||||
<loc>{{ url('post' . $i + 1 . '.xml').'/' }}</loc>
|
||||
</sitemap>
|
||||
@endif
|
||||
@endfor
|
||||
@endif
|
||||
</sitemapindex>
|
||||
22
resources/views/sitemap/news.blade.php
Normal file
22
resources/views/sitemap/news.blade.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
|
||||
@if (count($news) > 0)
|
||||
@foreach ($news as $new)
|
||||
<url>
|
||||
<loc>{{ route('detail', ['slug' => $new->slug]).'/' }}</loc>
|
||||
<lastmod>{{ $new->updated_at->setTimezone('Asia/Tehran')->toAtomString() }}</lastmod>
|
||||
<changefreq>{{ !is_null($new->changefreq) ? $new->changefreq : 'never' }}</changefreq>
|
||||
<image:image>
|
||||
<image:loc>{{ env('APP_URL_IMAGE').'images/'.$new->image }}</image:loc>
|
||||
</image:image>
|
||||
@if (isset($blogImages[$new->id]))
|
||||
@foreach ($blogImages[$new->id] as $imageUrl)
|
||||
<image:image>
|
||||
<image:loc>{{ $imageUrl }}</image:loc>
|
||||
</image:image>
|
||||
@endforeach
|
||||
@endif
|
||||
</url>
|
||||
@endforeach
|
||||
@endif
|
||||
</urlset>
|
||||
21
resources/views/sitemap/newscategory.blade.php
Normal file
21
resources/views/sitemap/newscategory.blade.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<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>
|
||||
8
resources/views/sitemap/page.blade.php
Normal file
8
resources/views/sitemap/page.blade.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>{{ env('APP_URL').'/' }}</loc>
|
||||
<lastmod>{{ $latestTimestamp->setTimezone('Asia/Tehran')->toAtomString() }}</lastmod>
|
||||
<changefreq>hourly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
</urlset>
|
||||
11
resources/views/sitemap/postcategory.blade.php
Normal file
11
resources/views/sitemap/postcategory.blade.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
@if (count($categories) > 0)
|
||||
@foreach ($categories as $category)
|
||||
<url>
|
||||
<loc>{{ url('category/' . $category->slug).'/' }}</loc>
|
||||
<lastmod>{{ $category->updated_at->setTimezone('Asia/Tehran')->toAtomString() }}</lastmod>
|
||||
|
||||
</url>
|
||||
@endforeach
|
||||
@endif
|
||||
</urlset>
|
||||
23
resources/views/sitemap/posts.blade.php
Normal file
23
resources/views/sitemap/posts.blade.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
|
||||
@if (count($blogs) > 0)
|
||||
@foreach ($blogs as $blog)
|
||||
<url>
|
||||
@if ($blog->status == 1)
|
||||
<loc>{{ route('detail', ['slug' => $blog->slug]).'/' }}</loc>
|
||||
<lastmod>{{ $blog->updated_at->setTimezone('Asia/Tehran')->toAtomString() }}</lastmod>
|
||||
<image:image>
|
||||
<image:loc>{{ env('APP_URL_IMAGE').'images/'.$blog->image }}</image:loc>
|
||||
</image:image>
|
||||
@if (isset($blogImages[$blog->id]))
|
||||
@foreach ($blogImages[$blog->id] as $imageUrl)
|
||||
<image:image>
|
||||
<image:loc>{{ $imageUrl }}</image:loc>
|
||||
</image:image>
|
||||
@endforeach
|
||||
@endif
|
||||
@endif
|
||||
</url>
|
||||
@endforeach
|
||||
@endif
|
||||
</urlset>
|
||||
Reference in New Issue
Block a user