X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FHttp%2FControllers%2FSitemapXmlController.php;h=4f66486b4b89f1576be894b9bb82bb5ddda4d69a;hb=e10222af705e3475fcea6e0b17d1c9984a62db26;hp=03a41c485e080c3f12351ef06df5ad00920277ed;hpb=c9a9e5a8836bc127c62316201854073abbe5d975;p=alttp.git diff --git a/app/Http/Controllers/SitemapXmlController.php b/app/Http/Controllers/SitemapXmlController.php index 03a41c4..4f66486 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; @@ -21,6 +23,34 @@ class SitemapXmlController extends Controller $urls[] = $url; } + foreach (['lw', 'dw', 'sp', 'uw', 'uw2'] as $map) { + $tech = TechniqueMap::where('map', '=', $map)->latest()->first(); + $url = new SitemapUrl(); + $url->path = '/map/'.$map; + if ($tech) { + $url->lastmod = $tech->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');