mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 18:20:48 +01:00
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
This commit is contained in:
27
app/Http/Controllers/HTMLSitemapController.php
Normal file
27
app/Http/Controllers/HTMLSitemapController.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Champion;
|
||||
use App\Models\ChampionSkin;
|
||||
use App\Models\SummonerIcon;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
use Spatie\Sheets\Facades\Sheets;
|
||||
|
||||
|
||||
class HTMLSitemapController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$twentyHoursInSeconds = 60 * 60 * 20;
|
||||
|
||||
$champions = Cache::remember('sitemap_championsCache', $twentyHoursInSeconds, fn () => 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'));
|
||||
}
|
||||
}
|
||||
@@ -30,12 +30,20 @@
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<div class="flex items-center justify-center w-full mb-6">
|
||||
<a href="https://www.producthunt.com/posts/heimerdinger-lol?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-heimerdinger-lol" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=442110&theme=dark" alt="Heimerdinger.lol - Discover LoL: Champions, Skins, Sales and More! | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
||||
<div class="flex items-center justify-center w-full mb-4">
|
||||
<a href="https://www.producthunt.com/posts/heimerdinger-lol?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-heimerdinger-lol"
|
||||
target="_blank"><img
|
||||
src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=442110&theme=dark"
|
||||
alt="Heimerdinger.lol - Discover LoL: Champions, Skins, Sales and More! | Product Hunt"
|
||||
style="width: 250px; height: 54px;" width="250" height="54"/></a>
|
||||
</div>
|
||||
<span
|
||||
class="flex mb-2 flex-row items-center justify-center text-sm text-gray-300 whitespace-pre sm:text-center dark:text-gray-300"> <a
|
||||
href="{{route('sitemap.index')}}" class="hover:underline">Sitemap</a></span>
|
||||
<span
|
||||
class="flex flex-row items-center justify-center text-sm text-gray-500 whitespace-pre sm:text-center dark:text-gray-400">© {{date('Y')}} <a
|
||||
href="/" class=" hover:underline">Heimerdinger.LoL</a> • Made with <a aria-label="Find out more about the creator of Heimerdinger.lol" href="https://rico.sh"><x-iconsax-bul-heart-circle
|
||||
class="relative self-center inline-block w-5 text-red-400"/></a></span>
|
||||
href="/" class=" hover:underline">Heimerdinger.LoL</a> • Made with <a
|
||||
aria-label="Find out more about the creator of Heimerdinger.lol" href="https://rico.sh"><x-iconsax-bul-heart-circle
|
||||
class="relative self-center inline-block w-5 text-red-400"/></a></span>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
110
resources/views/sitemap/index.blade.php
Normal file
110
resources/views/sitemap/index.blade.php
Normal file
@@ -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')
|
||||
<div class="flex justify-center"> <!-- Centering container -->
|
||||
<div>
|
||||
<h1 class="mt-6 mb-6 text-3xl font-bold text-center text-transparent uppercase sm:text-4xl bg-gradient-to-bl from-orange-300 to-orange-500 bg-clip-text">
|
||||
Heimerdinger Sitemap</h1>
|
||||
<div class="grid grid-cols-5 gap-4 ml-16 mr-16">
|
||||
<div>
|
||||
<h2 class="text-2xl font-bold text-stone-300">General</h2>
|
||||
<ul class="mt-2">
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('home') }}"
|
||||
class="text-orange-400 hover:text-orange-500">Home</a>
|
||||
</li>
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('champions.index') }}"
|
||||
class="text-orange-400 hover:text-orange-500">Champions</a>
|
||||
</li>
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('skins.index') }}"
|
||||
class="text-orange-400 hover:text-orange-500">Skins</a>
|
||||
</li>
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('assets.icons.index') }}"
|
||||
class="text-orange-400 hover:text-orange-500">Icons</a>
|
||||
</li>
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('assets.emotes.index') }}"
|
||||
class="text-orange-400 hover:text-orange-500">Emotes</a>
|
||||
</li>
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('sales.index') }}"
|
||||
class="text-orange-400 hover:text-orange-500">Sale Rotation</a>
|
||||
</li>
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('about.index') }}"
|
||||
class="text-orange-400 hover:text-orange-500">About</a>
|
||||
</li>
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('about.faq.leagueoflegends') }}"
|
||||
class="text-orange-400 hover:text-orange-500">FAQ: League of Legends</a>
|
||||
</li>
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('about.faq.heimerdinger') }}"
|
||||
class="text-orange-400 hover:text-orange-500">FAQ: Heimerdinger</a>
|
||||
</li>
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('posts.index') }}"
|
||||
class="text-orange-400 hover:text-orange-500">Blog Posts</a>
|
||||
</li>
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('contact.index') }}"
|
||||
class="text-orange-400 hover:text-orange-500">Contact</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="text-2xl font-bold text-stone-300">Champions</h2>
|
||||
<ul class="mt-2">
|
||||
@foreach ($champions as $champion)
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('champions.show', $champion->slug) }}"
|
||||
class="text-orange-400 hover:text-orange-500">{{ $champion->name }}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="text-2xl font-bold text-stone-300">Blog Posts</h2>
|
||||
<ul class="mt-2">
|
||||
@foreach ($posts as $post)
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('posts.show', $post->slug) }}"
|
||||
class="text-orange-400 hover:text-orange-500">{{ $post->title }}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="text-2xl font-bold text-stone-300">Skins</h2>
|
||||
<ul class="mt-2">
|
||||
@foreach ($skins as $skin)
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('skins.show', $skin->slug) }}"
|
||||
class="text-orange-400 hover:text-orange-500">{{ $skin->skin_name }}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="text-2xl font-bold text-stone-300">Icons</h2>
|
||||
<ul class="mt-2">
|
||||
@foreach ($icons as $icon)
|
||||
<li class="mb-1">
|
||||
<a href="{{ route('assets.icons.show', $icon->slug) }}"
|
||||
class="text-orange-400 hover:text-orange-500">{{ $icon->title }}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user