Show rel (nofollow/sponsored/ugc) badges on the backlinks table

The rel attribute has been captured on every backlink since that
table was added, but never displayed — a dofollow vs. nofollow
backlink is a real difference for SEO/competitive analysis, not just
a link count. Links with none of those tokens show as "dofollow".

Verified against real data (existing noopener-only link renders as
dofollow) plus a temporary synthetic nofollow+sponsored row to
confirm that branch too, removed after confirming.
This commit is contained in:
m105
2026-07-22 22:56:15 +03:00
parent 27f91c7fea
commit 59e152fd29
+14 -1
View File
@@ -79,10 +79,16 @@
<th class="px-4 py-2 text-left text-xs font-medium uppercase tracking-wide text-neutral-500">Referring site</th>
<th class="px-4 py-2 text-left text-xs font-medium uppercase tracking-wide text-neutral-500">Source page</th>
<th class="px-4 py-2 text-left text-xs font-medium uppercase tracking-wide text-neutral-500">Anchor text</th>
<th class="px-4 py-2 text-left text-xs font-medium uppercase tracking-wide text-neutral-500">Link type</th>
</tr>
</thead>
<tbody class="divide-y divide-neutral-200 dark:divide-neutral-800">
@forelse ($backlinks as $backlink)
@php
$relTags = $backlink->rel
? array_values(array_intersect(preg_split('/\s+/', strtolower($backlink->rel)), ['nofollow', 'sponsored', 'ugc']))
: [];
@endphp
<tr>
<td class="px-4 py-2 text-sm">
@if ($backlink->site)
@@ -103,10 +109,17 @@
@endif
</td>
<td class="max-w-xs truncate px-4 py-2 text-sm text-neutral-600 dark:text-neutral-400">{{ $backlink->anchor_text ?? '—' }}</td>
<td class="px-4 py-2 text-sm">
@forelse ($relTags as $tag)
<span class="mr-1 inline-block rounded-full bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700 dark:bg-amber-950 dark:text-amber-300">{{ $tag }}</span>
@empty
<span class="inline-block rounded-full bg-green-50 px-2 py-0.5 text-xs font-medium text-green-700 dark:bg-green-950 dark:text-green-300">dofollow</span>
@endforelse
</td>
</tr>
@empty
<tr>
<td colspan="3" class="px-4 py-6 text-center text-sm text-neutral-500">No backlinks found yet.</td>
<td colspan="4" class="px-4 py-6 text-center text-sm text-neutral-500">No backlinks found yet.</td>
</tr>
@endforelse
</tbody>