This commit is contained in:
2026-10-20 19:17:49 +04:00
parent be6115a151
commit dbc1dfdb8a
35 changed files with 662 additions and 94 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers;
use App\Models\News;
use App\Services\SeoService;
use Illuminate\Http\Response;
class SeoController extends Controller
{
public function robots(SeoService $seo): Response
{
$rules = config('seo.indexable')
? "User-agent: *\nAllow: /\nDisallow: /api/\nDisallow: /launcher/\nDisallow: /appcast.xml\nDisallow: /up\n\nSitemap: ".$seo->routeUrl('seo.sitemap')."\n"
: "User-agent: *\nDisallow: /\n";
return response($rules, 200, ['Content-Type' => 'text/plain; charset=UTF-8']);
}
public function sitemap(SeoService $seo): Response
{
return response()->view('seo.sitemap', [
'seo' => $seo,
'articles' => News::query()->published()->select(['id', 'updated_at'])->orderBy('id')->cursor(),
], 200, ['Content-Type' => 'application/xml; charset=UTF-8']);
}
}