Add backlinks section to the site detail page
Shows inbound links (who links to this site, via Site::inboundLinks()) with the referring site, source page, and anchor text — paginated separately from the Pages table via a distinct page-name query param so both can paginate independently. Also surfaces a simple outbound link count and a "N backlinks from M referring domains" summary. Verified against real data: crawled podcastyradio.es (previously only known as a backlink target from 00podcast.es) and confirmed its detail page correctly shows that inbound link with the right anchor text.
This commit is contained in:
@@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user