From 37bc210923f1d457414b185bd5ab86db5adab92e Mon Sep 17 00:00:00 2001 From: Rico van Zelst Date: Sun, 3 Mar 2024 17:23:22 +0100 Subject: [PATCH] feat(controller): add HTMLSitemapController for generating HTML sitemap - Added HTMLSitemapController to generate sitemap with cached data - Updated footer.blade.php and index.blade.php for sitemap links --- .../Controllers/HTMLSitemapController.php | 27 +++++ resources/views/components/footer.blade.php | 16 ++- resources/views/sitemap/index.blade.php | 110 ++++++++++++++++++ routes/web.php | 6 +- 4 files changed, 154 insertions(+), 5 deletions(-) create mode 100644 app/Http/Controllers/HTMLSitemapController.php create mode 100644 resources/views/sitemap/index.blade.php diff --git a/app/Http/Controllers/HTMLSitemapController.php b/app/Http/Controllers/HTMLSitemapController.php new file mode 100644 index 0000000..62c2303 --- /dev/null +++ b/app/Http/Controllers/HTMLSitemapController.php @@ -0,0 +1,27 @@ + Champion::orderBy('name')->get()); + $skins = Cache::remember('sitemap_championSkinsCache', $twentyHoursInSeconds, fn () => ChampionSkin::orderBy('skin_name')->get()); + $icons = Cache::remember('sitemap_iconsCache', $twentyHoursInSeconds, fn () => SummonerIcon::orderBy('title')->get()); + $posts = Sheets::all()->sortByDesc('date'); + + + return view('sitemap.index', compact('champions', 'skins', 'icons', 'posts')); + } +} diff --git a/resources/views/components/footer.blade.php b/resources/views/components/footer.blade.php index ebcae12..b8f1434 100644 --- a/resources/views/components/footer.blade.php +++ b/resources/views/components/footer.blade.php @@ -30,12 +30,20 @@ -
- Heimerdinger.lol - Discover LoL: Champions, Skins, Sales and More! | Product Hunt +
+ Heimerdinger.lol - Discover LoL: Champions, Skins, Sales and More! | Product Hunt
+ Sitemap © {{date('Y')}} Heimerdinger.LoL • Made with + href="/" class=" hover:underline">Heimerdinger.LoL • Made with
diff --git a/resources/views/sitemap/index.blade.php b/resources/views/sitemap/index.blade.php new file mode 100644 index 0000000..74a8a5e --- /dev/null +++ b/resources/views/sitemap/index.blade.php @@ -0,0 +1,110 @@ +@extends('layouts.app') + +@section('title', 'Heimerdinger.LoL • Sitemap (HTML)') +@section('description', 'Discover the complete sitemap for Heimerdinger.LoL, +your go-to source for all things League of Legends. +Explore champions, skins, game assets, and more in one convenient location.') + +@section('content') +
+
+

+ Heimerdinger Sitemap

+
+
+

General

+ +
+
+

Champions

+ +
+
+

Blog Posts

+ +
+
+

Skins

+ +
+
+

Icons

+ +
+
+
+
+@endsection diff --git a/routes/web.php b/routes/web.php index ad59d4a..6853f21 100644 --- a/routes/web.php +++ b/routes/web.php @@ -7,6 +7,7 @@ use App\Http\Controllers\ChampionSkinController; use App\Http\Controllers\ContactSubmissionController; use App\Http\Controllers\FAQController; use App\Http\Controllers\HomeController; +use App\Http\Controllers\HTMLSitemapController; use App\Http\Controllers\PostsController; use App\Http\Controllers\SaleController; use App\Http\Controllers\SummonerEmoteController; @@ -29,7 +30,7 @@ use Spatie\Honeypot\ProtectAgainstSpam; | */ -Route::get('/', static fn () => (new HomeController())->index()); +Route::get('/', static fn () => (new HomeController())->index())->name('home'); // Champions Route::get('/champions', static fn () => (new ChampionController())->index())->name('champions.index'); @@ -73,5 +74,8 @@ Route::post('/contact', function (ContactSubmissionRequest $request) { return (new ContactSubmissionController())->store($request); })->name('contact.store')->middleware(ProtectAgainstSpam::class); +// Site Map +Route::get('/resource/sitemap', static fn () => (new HTMLSitemapController())->index())->name('sitemap.index'); + // Pulse Route::get(config('app.login_route'), static fn () => redirect('/pulse'))->name('login')->middleware('auth.basic');