diff --git a/app/Http/Controllers/SitemapController.php b/app/Http/Controllers/SitemapController.php new file mode 100644 index 0000000..30a9067 --- /dev/null +++ b/app/Http/Controllers/SitemapController.php @@ -0,0 +1,24 @@ +orderBy('id')->get(); + + $xml = view('sitemap', ['sites' => $sites])->render(); + + return response($xml, 200)->header('Content-Type', 'application/xml'); + } +} diff --git a/public/robots.txt b/public/robots.txt deleted file mode 100644 index eb05362..0000000 --- a/public/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: diff --git a/resources/views/sitemap.blade.php b/resources/views/sitemap.blade.php new file mode 100644 index 0000000..cfe4f9b --- /dev/null +++ b/resources/views/sitemap.blade.php @@ -0,0 +1,26 @@ + + + + {{ route('home') }} + daily + 1.0 + + + {{ route('sites.index') }} + daily + 0.8 + + + {{ route('discover') }} + daily + 0.7 + +@foreach ($sites as $site) + + {{ route('sites.show', $site) }} + {{ $site->updated_at->toAtomString() }} + weekly + 0.5 + +@endforeach + diff --git a/resources/views/sites/show.blade.php b/resources/views/sites/show.blade.php index 9e89eab..51cc8cf 100644 --- a/resources/views/sites/show.blade.php +++ b/resources/views/sites/show.blade.php @@ -1,4 +1,10 @@ - +@php + $metaDescription = $site->description + ?: ($site->title + ? "{$site->title} ({$site->domain}) — competitor analysis, backlinks, and tech stack." + : "Competitor analysis for {$site->domain}: pages, backlinks, and tech stack."); +@endphp +
← Back to sites @@ -25,6 +31,16 @@

@endif + @guest +
+ You're viewing limited data for this site. + Create a free account + or + sign in + to see all of its pages, backlinks, and subdomains. +
+ @endguest + @if ($site->server || $site->powered_by || $site->generator)
@if ($site->generator) diff --git a/routes/web.php b/routes/web.php index d2ef9bf..905c01f 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,6 +1,7 @@ name('sites.index'); Route::get('/sites/{site}', [SiteController::class, 'show'])->name('sites.show'); Route::get('/discover', DiscoverSearch::class)->name('discover'); +Route::get('/sitemap.xml', SitemapController::class)->name('sitemap'); + +Route::get('/robots.txt', function () { + return response("User-agent: *\nDisallow:\nSitemap: ".url('/sitemap.xml')."\n") + ->header('Content-Type', 'text/plain'); +})->name('robots'); + Route::view('profile', 'profile') ->middleware(['auth']) ->name('profile');