improved sitemap

pull/49/head
A1Gard 1 month ago
parent 239ae1009c
commit ed4d58bd4d

@ -643,7 +643,38 @@ class ClientController extends Controller
public function sitemap() public function sitemap()
{ {
header('content-type: text/xml'); header('content-type: text/xml');
return view('website.sitemap'); echo '<? xml version = "1.0" encoding = "utf-8" ?>'.PHP_EOL;
return view('website.sitemaps.sitemap');
}
public function sitemapPosts()
{
header('content-type: text/xml');
echo '<? xml version = "1.0" encoding = "utf-8" ?>'.PHP_EOL;
return view('website.sitemaps.sitemap-posts');
}
public function sitemapProducts()
{
header('content-type: text/xml');
echo '<? xml version = "1.0" encoding = "utf-8" ?>'.PHP_EOL;
return view('website.sitemaps.sitemap-products');
}
public function sitemapClips()
{
header('content-type: text/xml');
echo '<? xml version = "1.0" encoding = "utf-8" ?>'.PHP_EOL;
return view('website.sitemaps.sitemap-clips');
}
public function sitemapGalleries()
{
header('content-type: text/xml');
echo '<? xml version = "1.0" encoding = "utf-8" ?>'.PHP_EOL;
return view('website.sitemaps.sitemap-gallries');
}
public function sitemapAttachments()
{
header('content-type: text/xml');
echo '<? xml version = "1.0" encoding = "utf-8" ?>'.PHP_EOL;
return view('website.sitemaps.sitemap-attachments');
} }
public function lang(Request $request) public function lang(Request $request)

@ -8,6 +8,8 @@
<meta name="theme-color" content="{{gfx()['primary']}}"/> <meta name="theme-color" content="{{gfx()['primary']}}"/>
@if(! config('app.demo')) @if(! config('app.demo'))
<meta name="robots" content="follow,index"> <meta name="robots" content="follow,index">
@else
<meta name="robots" content="noindex">
@endif @endif
<meta name="generator" content="xShop; version={{config('app.version')}}"> <meta name="generator" content="xShop; version={{config('app.version')}}">

@ -1,192 +0,0 @@
<? xml version = "1.0" encoding = "utf-8" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@if(\App\Models\Product::count() > 0)
<url>
<loc>{{route('client.products')}}</loc>
<lastmod>{{\App\Models\Product::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
@endif
@if(\App\Models\Post::count() > 0)
<url>
<loc>{{route('client.posts')}}</loc>
<lastmod>{{\App\Models\Post::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>1</priority>
</url>
@endif
@if(\App\Models\Gallery::count() > 0)
<url>
<loc>{{route('client.galleries')}}</loc>
<lastmod>{{\App\Models\Gallery::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>2</priority>
</url>
@endif
@if(\App\Models\Attachment::count() > 0)
<url>
<loc>{{route('client.attachments')}}</loc>
<lastmod>{{\App\Models\Attachment::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>2</priority>
</url>
@endif
@if(\App\Models\Clip::count() > 0)
<url>
<loc>{{route('client.clips')}}</loc>
<lastmod>{{\App\Models\Clip::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>2</priority>
</url>
@endif
@foreach(\App\Models\Product::where('status',1)->orderBy('id')->get(['slug','updated_at']) as $item)
<url>
<loc>{{route('client.product',$item->slug)}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@foreach(\App\Models\Post::where('status',1)->orderBy('id')->get(['slug','updated_at']) as $item)
<url>
<loc>{{route('client.post',$item->slug)}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@foreach(\App\Models\Clip::where('status',1)->orderBy('id')->get(['slug','updated_at']) as $item)
<url>
<loc>{{route('client.clip',$item->slug)}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@foreach(\App\Models\Gallery::where('status',1)->orderBy('id')->get(['slug','updated_at']) as $item)
<url>
<loc>{{route('client.gallery',$item->slug)}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@foreach(\App\Models\Attachment::where('is_fillable',1)->orderBy('id')->get(['slug','updated_at']) as $item)
<url>
<loc>{{route('client.attachment',$item->slug)}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@if(config('app.xlang.active'))
@foreach(\App\Models\XLang::where('is_default',0)->pluck('tag')->toArray() as $lang)
@php(app()->setLocale($lang))
@if(\App\Models\Product::count() > 0)
<url>
<loc>{{route('client.products')}}/{{$lang}}</loc>
<lastmod>{{\App\Models\Product::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
@endif
@if(\App\Models\Post::count() > 0)
<url>
<loc>{{route('client.posts')}}/{{$lang}}</loc>
<lastmod>{{\App\Models\Post::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>1</priority>
</url>
@endif
@if(\App\Models\Gallery::count() > 0)
<url>
<loc>{{route('client.galleries')}}/{{$lang}}</loc>
<lastmod>{{\App\Models\Gallery::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>2</priority>
</url>
@endif
@if(\App\Models\Attachment::count() > 0)
<url>
<loc>{{route('client.attachments')}}/{{$lang}}</loc>
<lastmod>{{\App\Models\Attachment::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>2</priority>
</url>
@endif
@if(\App\Models\Clip::count() > 0)
<url>
<loc>{{route('client.clips')}}/{{$lang}}</loc>
<lastmod>{{\App\Models\Clip::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>2</priority>
</url>
@endif
@foreach(\App\Models\Product::where('status',1)->whereLocale('name',$lang)->orderBy('id')->get(['slug','updated_at','name']) as $item)
<url>
<loc>{{$item->webUrl()}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@foreach(\App\Models\Post::where('status',1)->whereLocale('title',$lang)->orderBy('id')->get(['slug','updated_at','title']) as $item)
<url>
<loc>{{$item->webUrl()}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@foreach(\App\Models\Clip::where('status',1)->whereLocale('title',$lang)->orderBy('id')->get(['slug','updated_at','title']) as $item)
<url>
<loc>{{$item->webUrl()}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@foreach(\App\Models\Gallery::where('status',1)->whereLocale('title',$lang)->orderBy('id')->get(['slug','updated_at','title']) as $item)
<url>
<loc>{{$item->webUrl()}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@foreach(\App\Models\Attachment::where('is_fillable',1)->whereLocale('title',$lang)->orderBy('id')->get(['slug','updated_at','title']) as $item)
<url>
<loc>{{$item->webUrl()}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@endforeach
@endif
</urlset>

@ -0,0 +1,50 @@
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@if(\App\Models\Attachment::count() > 0)
<url>
<loc>{{route('client.attachments')}}</loc>
<lastmod>{{\App\Models\Attachment::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>2</priority>
</url>
@endif
@foreach(\App\Models\Attachment::where('is_fillable',1)->orderBy('id')->get(['slug','updated_at']) as $item)
<url>
<loc>{{route('client.attachment',$item->slug)}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@if(config('app.xlang.active'))
@foreach(\App\Models\XLang::where('is_default',0)->pluck('tag')->toArray() as $lang)
@php(app()->setLocale($lang))
@if(\App\Models\Attachment::count() > 0)
<url>
<loc>{{route('client.attachments')}}/{{$lang}}</loc>
<lastmod>{{\App\Models\Attachment::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>2</priority>
</url>
@endif
@foreach(\App\Models\Attachment::where('is_fillable',1)->whereLocale('title',$lang)->orderBy('id')->get(['slug','updated_at','title']) as $item)
<url>
<loc>{{$item->webUrl()}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@endforeach
@endif
</urlset>

@ -0,0 +1,48 @@
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@if(\App\Models\Clip::count() > 0)
<url>
<loc>{{route('client.clips')}}</loc>
<lastmod>{{\App\Models\Clip::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>2</priority>
</url>
@endif
@foreach(\App\Models\Clip::where('status',1)->orderBy('id')->get(['slug','updated_at']) as $item)
<url>
<loc>{{route('client.clip',$item->slug)}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@if(config('app.xlang.active'))
@foreach(\App\Models\XLang::where('is_default',0)->pluck('tag')->toArray() as $lang)
@php(app()->setLocale($lang))
@if(\App\Models\Clip::count() > 0)
<url>
<loc>{{route('client.clips')}}/{{$lang}}</loc>
<lastmod>{{\App\Models\Clip::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>2</priority>
</url>
@endif
@foreach(\App\Models\Clip::where('status',1)->whereLocale('title',$lang)->orderBy('id')->get(['slug','updated_at','title']) as $item)
<url>
<loc>{{$item->webUrl()}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@endforeach
@endif
</urlset>

@ -0,0 +1,50 @@
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@if(\App\Models\Gallery::count() > 0)
<url>
<loc>{{route('client.galleries')}}</loc>
<lastmod>{{\App\Models\Gallery::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>2</priority>
</url>
@endif
@foreach(\App\Models\Gallery::where('status',1)->orderBy('id')->get(['slug','updated_at']) as $item)
<url>
<loc>{{route('client.gallery',$item->slug)}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@if(config('app.xlang.active'))
@foreach(\App\Models\XLang::where('is_default',0)->pluck('tag')->toArray() as $lang)
@php(app()->setLocale($lang))
@if(\App\Models\Gallery::count() > 0)
<url>
<loc>{{route('client.galleries')}}/{{$lang}}</loc>
<lastmod>{{\App\Models\Gallery::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>2</priority>
</url>
@endif
@foreach(\App\Models\Gallery::where('status',1)->whereLocale('title',$lang)->orderBy('id')->get(['slug','updated_at','title']) as $item)
<url>
<loc>{{$item->webUrl()}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@endforeach
@endif
</urlset>

@ -0,0 +1,50 @@
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@if(\App\Models\Post::count() > 0)
<url>
<loc>{{route('client.posts')}}</loc>
<lastmod>{{\App\Models\Post::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>1</priority>
</url>
@endif
@foreach(\App\Models\Post::where('status',1)->orderBy('id')->get(['slug','updated_at']) as $item)
<url>
<loc>{{route('client.post',$item->slug)}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@if(config('app.xlang.active'))
@foreach(\App\Models\XLang::where('is_default',0)->pluck('tag')->toArray() as $lang)
@php(app()->setLocale($lang))
@if(\App\Models\Post::count() > 0)
<url>
<loc>{{route('client.posts')}}/{{$lang}}</loc>
<lastmod>{{\App\Models\Post::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>1</priority>
</url>
@endif
@foreach(\App\Models\Post::where('status',1)->whereLocale('title',$lang)->orderBy('id')->get(['slug','updated_at','title']) as $item)
<url>
<loc>{{$item->webUrl()}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@endforeach
@endif
</urlset>

@ -0,0 +1,50 @@
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@if(\App\Models\Product::count() > 0)
<url>
<loc>{{route('client.products')}}</loc>
<lastmod>{{\App\Models\Product::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
@endif
@foreach(\App\Models\Product::where('status',1)->orderBy('id')->get(['slug','updated_at']) as $item)
<url>
<loc>{{route('client.product',$item->slug)}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@if(config('app.xlang.active'))
@foreach(\App\Models\XLang::where('is_default',0)->pluck('tag')->toArray() as $lang)
@php(app()->setLocale($lang))
@if(\App\Models\Product::count() > 0)
<url>
<loc>{{route('client.products')}}/{{$lang}}</loc>
<lastmod>{{\App\Models\Product::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
@endif
@foreach(\App\Models\Product::where('status',1)->whereLocale('name',$lang)->orderBy('id')->get(['slug','updated_at','name']) as $item)
<url>
<loc>{{$item->webUrl()}}</loc>
<lastmod>{{$item->updated_at->tz('UTC')->toAtomString()}}</lastmod>
<changefreq>weekly</changefreq>
<priority>3</priority>
</url>
@endforeach
@endforeach
@endif
</urlset>

@ -0,0 +1,50 @@
<sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@if(\App\Models\Product::count() > 0)
<sitemap>
<loc>{{route('sitemap.products')}}</loc>
<lastmod>{{\App\Models\Product::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
</sitemap>
@endif
@if(\App\Models\Post::count() > 0)
<sitemap>
<loc>{{route('sitemap.posts')}}</loc>
<lastmod>{{\App\Models\Post::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
</sitemap>
@endif
@if(\App\Models\Gallery::count() > 0)
<sitemap>
<loc>{{route('sitemap.galleries')}}</loc>
<lastmod>{{\App\Models\Gallery::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
</sitemap>
@endif
@if(\App\Models\Clip::count() > 0)
<sitemap>
<loc>{{route('sitemap.clips')}}</loc>
<lastmod>{{\App\Models\Clip::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
</sitemap>
@endif
@if(\App\Models\Attachment::count() > 0)
<sitemap>
<loc>{{route('sitemap.attachments')}}</loc>
<lastmod>{{\App\Models\Attachment::orderByDesc('updated_at')->first()->updated_at->tz('UTC')->toAtomString()}}</lastmod>
</sitemap>
@endif
</sitemapindex>

@ -447,6 +447,11 @@ Route::middleware([\App\Http\Middleware\VisitorCounter::class])
Route::get('/sitemap.xml', [ClientController::class, 'sitemap'])->name('sitemap'); Route::get('/sitemap.xml', [ClientController::class, 'sitemap'])->name('sitemap');
Route::get('/sitemap/products.xml', [ClientController::class, 'sitemapProducts'])->name('sitemap.products');
Route::get('/sitemap/posts.xml', [ClientController::class, 'sitemapPosts'])->name('sitemap.posts');
Route::get('/sitemap/clips.xml', [ClientController::class, 'sitemapClips'])->name('sitemap.clips');
Route::get('/sitemap/galleries.xml', [ClientController::class, 'sitemapGalleries'])->name('sitemap.galleries');
Route::get('/sitemap/attachments.xml', [ClientController::class, 'sitemapAttachments'])->name('sitemap.attachments');
// to developer test // to developer test
Route::get('login/as/{mobile}', function ($mobile) { Route::get('login/as/{mobile}', function ($mobile) {

Loading…
Cancel
Save