diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php index 93d51cc..683038c 100644 --- a/app/Http/Controllers/SiteController.php +++ b/app/Http/Controllers/SiteController.php @@ -9,8 +9,22 @@ class SiteController extends Controller { public function show(Site $site): View { - $pages = $site->pages()->orderBy('url')->paginate(50); + $pages = $site->pages()->orderBy('url')->paginate(50, ['*'], 'pages_page'); - return view('sites.show', ['site' => $site, 'pages' => $pages]); + $backlinks = $site->inboundLinks() + ->with(['site', 'sitePage']) + ->latest() + ->paginate(50, ['*'], 'backlinks_page'); + + $referringDomainsCount = $site->inboundLinks()->distinct()->count('site_id'); + $outboundLinksCount = $site->outboundLinks()->count(); + + return view('sites.show', [ + 'site' => $site, + 'pages' => $pages, + 'backlinks' => $backlinks, + 'referringDomainsCount' => $referringDomainsCount, + 'outboundLinksCount' => $outboundLinksCount, + ]); } } diff --git a/resources/views/sites/show.blade.php b/resources/views/sites/show.blade.php index 17a6e3b..1260bd7 100644 --- a/resources/views/sites/show.blade.php +++ b/resources/views/sites/show.blade.php @@ -50,5 +50,57 @@
{{ $pages->links() }}
+ +

+ Backlinks ({{ $backlinks->total() }} from {{ number_format($referringDomainsCount) }} referring {{ \Illuminate\Support\Str::plural('domain', $referringDomainsCount) }}) +

+

+ Also links out to {{ number_format($outboundLinksCount) }} {{ \Illuminate\Support\Str::plural('page', $outboundLinksCount) }} on other domains. +

+ +
+ + + + + + + + + + @forelse ($backlinks as $backlink) + + + + + + @empty + + + + @endforelse + +
Referring siteSource pageAnchor text
+ @if ($backlink->site) + + {{ $backlink->site->domain }} + + @else + — + @endif + + @if ($backlink->sitePage) + + {{ $backlink->sitePage->url }} + + @else + — + @endif + {{ $backlink->anchor_text ?? '—' }}
No backlinks found yet.
+
+ +
+ {{ $backlinks->links() }} +