X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FHttp%2FControllers%2FSitemapXmlController.php;h=99e909212f2bbced0371e0b9c01f9f6ea9e00684;hb=5dfd6a1dbe115dfd01bd487181e1ce056d0ee82b;hp=35302c4a326795ce3ceabdc5f91ce6d709e8eb1a;hpb=6609e9cbc3c9d3f9a7f0b2db9d8407f56957cef5;p=alttp.git diff --git a/app/Http/Controllers/SitemapXmlController.php b/app/Http/Controllers/SitemapXmlController.php index 35302c4..99e9092 100644 --- a/app/Http/Controllers/SitemapXmlController.php +++ b/app/Http/Controllers/SitemapXmlController.php @@ -3,6 +3,8 @@ namespace App\Http\Controllers; use App\Models\SitemapUrl; +use App\Models\Technique; +use App\Models\TechniqueMap; use App\Models\Tournament; use Illuminate\Http\Request; @@ -14,13 +16,36 @@ class SitemapXmlController extends Controller foreach (Tournament::all() as $tournament) { $url = new SitemapUrl(); - $url->path = '/tournaments'.$tournament->id; + $url->path = '/tournaments/'.$tournament->id; $url->lastmod = $tournament->updated_at ? $tournament->updated_at : ($tournament->created_at ? $tournament->created_at : now()); $url->changefreq = $tournament->locked ? 'never' : 'daily'; $url->priority = $tournament->locked ? 0.5 : 1.0; $urls[] = $url; } + $url = new SitemapUrl(); + $url->path = '/map'; + $url->lastmod = TechniqueMap::latest()->first()->created_at; + $url->changefreq = 'monthly'; + $url->priority = 0.9; + $urls[] = $url; + + $url = new SitemapUrl(); + $url->path = '/tech'; + $url->lastmod = Technique::where('type', '=', 'tech')->where('index', true)->latest()->first()->created_at; + $url->changefreq = 'monthly'; + $url->priority = 0.8; + $urls[] = $url; + + foreach (Technique::where('type', '=', 'tech')->where('index', true)->get() as $tech) { + $url = new SitemapUrl(); + $url->path = '/tech/'.rawurlencode($tech->name); + $url->lastmod = $tech->updated_at ? $tech->updated_at : ($tech->created_at ? $tech->created_at : now()); + $url->changefreq = 'never'; + $url->priority = $tech->priority; + $urls[] = $url; + } + return response()->view('sitemap', [ 'urls' => $urls, ])->header('Content-Type', 'text/xml');