From cdf17f92d73dc24c049d52f556dcad4cd6a6a3ec Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 31 May 2026 03:02:12 +0300 Subject: [PATCH] SEO fixes: robots.txt, canonicals, noindex, og tags, breadcrumbs, similar games, review schema - robots.txt: proper Disallow rules + sitemap URL - Layout: robots meta tag, fix canonical syntax, og:site_name, full Twitter Card tags - Game pages: canonical URLs, og:type website, breadcrumb nav + JSON-LD schema - Screenshot alt text with game title and index - VideoGame JSON-LD: review array with rating/author/body - Similar Games section on game detail (by genre, ordered by rating) - browse/index: noindex on paginated or multi-filter pages - search results: noindex + improved title - User library and lists: noindex - Unique meta descriptions on browse, top-rated, new-releases pages Co-Authored-By: Claude Sonnet 4.6 --- app/Http/Controllers/GameController.php | 18 ++++++- public/robots.txt | 14 +++++- resources/views/games/index.blade.php | 5 ++ resources/views/games/new-releases.blade.php | 4 +- resources/views/games/search.blade.php | 3 +- resources/views/games/show.blade.php | 53 ++++++++++++++++++-- resources/views/games/top-rated.blade.php | 2 + resources/views/layouts/app.blade.php | 7 ++- resources/views/lists/index.blade.php | 1 + resources/views/users/library.blade.php | 1 + resources/views/users/show.blade.php | 1 + 11 files changed, 100 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/GameController.php b/app/Http/Controllers/GameController.php index 6e60866..cac3d37 100644 --- a/app/Http/Controllers/GameController.php +++ b/app/Http/Controllers/GameController.php @@ -39,7 +39,10 @@ class GameController extends Controller $genres = Genre::orderBy('name')->get(); $platforms = Platform::orderBy('name')->get(); - return view('games.index', compact('games', 'genres', 'platforms')); + $shouldNoindex = ($request->get('page', 1) > 1) || + (collect(['genre', 'platform', 'year', 'sort', 'q'])->filter(fn($k) => $request->filled($k))->count() >= 2); + + return view('games.index', compact('games', 'genres', 'platforms', 'shouldNoindex')); } public function show(Game $game) @@ -61,7 +64,18 @@ class GameController extends Controller ->limit(20) ->get(); - $response = view('games.show', compact('game', 'userGame', 'userReview', 'userLists', 'comments')); + $similarGames = collect(); + if ($game->genres->isNotEmpty()) { + $similarGames = Game::published() + ->whereHas('genres', fn($q) => $q->whereIn('genres.id', $game->genres->pluck('id'))) + ->where('id', '!=', $game->id) + ->where('rating_count', '>=', 1) + ->orderByDesc('rating_avg') + ->limit(6) + ->get(); + } + + $response = view('games.show', compact('game', 'userGame', 'userReview', 'userLists', 'comments', 'similarGames')); return auth()->check() ? $response : response($response)->header('Cache-Control', 'public, max-age=300'); diff --git a/public/robots.txt b/public/robots.txt index 12aa2e9..56c794e 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,6 +1,18 @@ User-agent: * Allow: / -Disallow: /profile + Disallow: /dashboard +Disallow: /profile +Disallow: /library +Disallow: /notifications +Disallow: /activity +Disallow: /login +Disallow: /register +Disallow: /forgot-password +Disallow: /reset-password +Disallow: /verify-email +Disallow: /games/search +Disallow: /lists +Disallow: /*?*page=* Sitemap: https://gamelog.ro/sitemap.xml diff --git a/resources/views/games/index.blade.php b/resources/views/games/index.blade.php index e0f5ffa..b204e8d 100644 --- a/resources/views/games/index.blade.php +++ b/resources/views/games/index.blade.php @@ -1,6 +1,11 @@ @extends('layouts.app') @section('title', 'Browse Games — GameLog') +@section('description', 'Browse and discover video games. Filter by genre, platform, and year. Find your next favorite game on GameLog.') +@section('canonical', route('games.index')) +@if($shouldNoindex ?? false) +@section('robots', 'noindex,follow') +@endif @section('content')
diff --git a/resources/views/games/new-releases.blade.php b/resources/views/games/new-releases.blade.php index 55c389f..46711c8 100644 --- a/resources/views/games/new-releases.blade.php +++ b/resources/views/games/new-releases.blade.php @@ -1,6 +1,8 @@ @extends('layouts.app') -@section('title', 'New Releases — GameLog') +@section('title', 'New Game Releases — GameLog') +@section('description', 'Browse the latest video game releases. Stay up to date with new games across all platforms.') +@section('canonical', route('games.new-releases')) @section('content')
diff --git a/resources/views/games/search.blade.php b/resources/views/games/search.blade.php index a145283..c50ada2 100644 --- a/resources/views/games/search.blade.php +++ b/resources/views/games/search.blade.php @@ -1,6 +1,7 @@ @extends('layouts.app') -@section('title', $q ? "Search: {$q} — GameLog" : 'Search Games — GameLog') +@section('title', $q ? "Search Results for \"{$q}\" — GameLog" : 'Search Games — GameLog') +@section('robots', 'noindex,follow') @section('content')
diff --git a/resources/views/games/show.blade.php b/resources/views/games/show.blade.php index 276eafb..c54f3ae 100644 --- a/resources/views/games/show.blade.php +++ b/resources/views/games/show.blade.php @@ -6,9 +6,19 @@ @section('og_title', $game->title . ' — GameLog') @section('og_description', $game->summary ? Str::limit($game->summary, 155) : 'Track ' . $game->title . ' on GameLog.') @section('og_image', $game->cover_url ?? asset('images/og-default.jpg')) -@section('og_type', 'game') +@section('og_type', 'website') +@section('canonical', route('games.show', $game)) @section('content') +
{{-- Main Info --}} @@ -269,7 +279,7 @@
@foreach($game->screenshots as $i => $shot) @endforeach
@@ -304,7 +314,7 @@ {{-- Full-size image --}} - Screenshot + {{-- Next --}}
+ @if($similarGames->isNotEmpty()) +
+

You Might Also Like

+
+ @foreach($similarGames as $similar) + + @endforeach +
+
+ @endif +
@push('scripts') +