Add sitemap.xml/robots.txt and a clearer guest message on site pages
Sitemap lists the static pages plus one URL per indexed site (644
URLs currently); not sharded — fine at this scale, but the sitemap
protocol caps a single file at 50,000 URLs, so this will need a
sitemap index if the site count ever gets there. robots.txt moved
from a static public file to a route so it can point at the real
sitemap URL in any environment (a static file would also silently
shadow the dynamic route in production, since webservers serve
existing public/ files before hitting Laravel's router at all).
Site detail page: guests now get one prominent banner up top ("you're
viewing limited data — register or sign in to see everything") in
addition to the existing per-section "N of M results" notices, so the
overall gating is obvious immediately rather than only on scroll.
Also gave site pages a real per-page meta description (using the
site's own description/title) instead of falling back to the generic
site-wide one — worth doing now that these pages are actually in the
sitemap and indexable.
Caught and fixed a real Blade bug along the way: an inline
:description="..." expression on <x-layouts.app> with escaped
double-quoted PHP strings corrupted the compiler's directive parsing
in a way that only surfaced as a 500 on a page rendering the guest
@guest block below it (mismatched @if/@endif at compile time) — not
on the expression itself. Fixed by computing the description in a
@php block first and passing a plain variable instead.
Verified over real HTTP: sitemap.xml validates as well-formed XML
(644 <url> entries), robots.txt correctly emits the live sitemap URL,
the guest banner and site-specific meta description both render
correctly. Full test suite (31 tests) passes.
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
<x-layouts.app :title="$site->domain">
|
||||
@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
|
||||
<x-layouts.app :title="$site->domain" :description="$metaDescription">
|
||||
<div class="mx-auto max-w-5xl px-4 py-8">
|
||||
<a href="{{ route('sites.index') }}" class="text-sm text-blue-600 hover:underline dark:text-blue-400">← Back to sites</a>
|
||||
|
||||
@@ -25,6 +31,16 @@
|
||||
</p>
|
||||
@endif
|
||||
|
||||
@guest
|
||||
<div class="mt-4 rounded-lg border border-blue-200 bg-blue-50 px-4 py-3 text-sm text-blue-800 dark:border-blue-900 dark:bg-blue-950 dark:text-blue-300">
|
||||
You're viewing limited data for this site.
|
||||
<a href="{{ route('register') }}" class="font-medium underline">Create a free account</a>
|
||||
or
|
||||
<a href="{{ route('login') }}" class="font-medium underline">sign in</a>
|
||||
to see all of its pages, backlinks, and subdomains.
|
||||
</div>
|
||||
@endguest
|
||||
|
||||
@if ($site->server || $site->powered_by || $site->generator)
|
||||
<div class="mt-3 flex flex-wrap gap-2">
|
||||
@if ($site->generator)
|
||||
|
||||
Reference in New Issue
Block a user