Files
supermarket/internal/web/templates/seo-links.html
T
davidandClaude Opus 5.5 a1409d91ad Phase 8 part 3: lost links
Each known linking page (from Bing, Plausible or added by hand) is
opened once a week, at most 100 a day, to check it still links to the
site: kept, gone (the page no longer has the link), page gone (404, 410
or moved elsewhere) or pointing at a 404 (our page it links to is gone).
SEO → Links lists the lost ones with what happened, when last seen and
what the site brought; links can be added by hand (checked at once),
checked now, or forgotten. What to write next suggests a redirect for a
link to a 404, and asking for a lost link back when it brought visitors.
Links and What to write next now work for websites without Search
Console too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 08:43:30 -07:00

92 lines
8.4 KiB
HTML

{{define "content"}}{{with .Data}}{{$d := .}}
<div class="heading"><h1>Links</h1></div>
<p class="lede">Links from other sites to yours: the ones that bring visitors and sign-ups, the ones search engines have found, and whether each is still there. A link that brings people who sign up is worth more than any number of links nobody clicks.</p>
{{template "seo-sites" .}}
{{if .Current}}
<section class="card">
<h2>Links that bring visitors</h2>
<p class="small">From Plausible, the last 90 days: other sites whose links people followed to yours, the pages they landed on, and how many of them signed up or sent a form. Search engines, social networks, email and AI assistants are counted apart, below.</p>
{{if not $d.Plausible}}<p class="warn-text small">Save a Plausible key under <a href="/settings/tracking">Settings → Website &amp; sales</a> to see them.</p>
{{else if not $d.Read}}<p class="help">Not read yet: it's read with the daily Plausible import, or now with <em>Import now</em> under <a href="/settings/tracking">Settings → Website &amp; sales</a>.</p>
{{else}}
{{with $d.Links}}
<table class="list">
<thead><tr><th>Site</th><th class="num">Visitors</th><th class="num">Sign-ups</th><th>Landed on</th><th>The linking page</th></tr></thead>
<tbody>{{range .}}<tr>
<td><strong>{{.Source}}</strong>{{if .New}} <span class="badge published">new</span>{{end}}<br><span class="small muted">since {{.FirstSeen}}</span></td>
<td class="num">{{num .Visitors}}</td>
<td class="num">{{if .Signups}}<strong>{{num .Signups}}</strong>{{else}}<span class="muted">0</span>{{end}}</td>
<td class="small">{{range $i, $p := .Pages}}{{if lt $i 3}}{{if $i}}, {{end}}{{$p}}{{end}}{{end}}</td>
<td class="small">{{range .Linking}}<a href="{{.}}" target="_blank" rel="noopener noreferrer">{{truncate 60 .}}</a><br>{{else}}<span class="muted">not given</span>{{end}}</td>
</tr>{{end}}</tbody>
</table>
{{else}}<p class="help">No other site sent visitors in the last 90 days.</p>{{end}}
{{with $d.Others}}<p class="small muted">Also, in visitors: {{with index . "search"}}search engines {{num .}} · {{end}}{{with index . "social"}}social networks {{num .}} · {{end}}{{with index . "ai"}}AI assistants {{num .}} · {{end}}{{with index . "email"}}email {{num .}} · {{end}}{{with index . "app"}}work apps (CRMs, chat, documents) {{num .}} · {{end}}{{with index . "own"}}your other sites {{num .}} · {{end}}{{with index . "tagged"}}tagged links {{num .}}{{end}}</p>{{end}}
<p class="small muted">Browsers usually tell a site only which site a visitor came from, not the page: where the page isn't given, find the link on that site, or add it by hand once that's possible. Visits with no referrer at all (typed in, bookmarks, apps that hide it) aren't counted here. {{with $d.Known}}{{.}} linking {{if eq . 1}}page is{{else}}pages are{{end}} known.{{end}}</p>
{{end}}
{{template "last-read" $d.Last}}
</section>
<section class="card" id="bing">
<h2>Who links to you</h2>
<p class="small">From Bing Webmaster Tools, read once a week: how many links Bing has found to each of your pages, and, for the most linked ones, the pages that link and their link text. Google doesn't share its links through its API; Bing's index is a fair stand-in. The linking pages Plausible names, and ones you add under Lost links, are listed with them.</p>
{{if not $d.BingKey}}
<p class="warn-text small">Save a Bing Webmaster API key under <a href="/settings/search">Settings → Search engines</a>: in Bing Webmaster Tools, add and verify {{$d.Current.URL}} (it can import the site from Google Search Console), then Settings (the gear) → API access → API key.</p>
{{else}}
<form method="post" action="/seo/links/bing?site={{$d.Current.Index}}" data-busy="Reading Bing…" class="row">
<span class="small muted">{{with $d.Bing}}Read {{ago .At}}{{if .Total}}: {{num .Total}} {{if eq .Total 1}}link{{else}}links{{end}} to {{len .Pages}} {{if eq (len .Pages) 1}}page{{else}}pages{{end}}{{end}}.{{else}}Not read yet.{{end}} Bing names the site <code>{{$d.BingSite}}</code>.</span>
<button type="submit" class="secondary small">Read now</button>
</form>
{{with $d.Bing}}{{with .Error}}<p class="error-text small">{{.}}</p>{{end}}{{end}}
{{end}}
{{with $d.LinkingSites}}
<table class="list">
<thead><tr><th>Linking site</th><th class="num">Pages</th><th>To your pages</th><th>Link text</th></tr></thead>
<tbody>{{range .}}<tr>
<td><a href="{{.Example}}" target="_blank" rel="noopener noreferrer">{{.Host}}</a>{{if .New}} <span class="badge published">new</span>{{end}}<br><span class="small muted">since {{.FirstSeen}}</span></td>
<td class="num">{{num .Links}}</td>
<td class="small">{{range $i, $t := .Targets}}{{if lt $i 3}}{{if $i}}, {{end}}{{$t}}{{end}}{{end}}</td>
<td class="small">{{range $i, $a := .Anchors}}{{if $i}} · {{end}}“{{$a}}”{{end}}</td>
</tr>{{end}}</tbody>
</table>
{{with $d.MoreSites}}<p class="help">And {{.}} more sites.</p>{{end}}
{{else}}{{if $d.Bing}}<p class="help">Bing hasn't found links to the site yet.</p>{{end}}{{end}}
{{with $d.Bing}}{{with .Pages}}
<details class="small"><summary>Your most linked pages, by Bing's count</summary>
<table class="list compact"><tbody>{{range $i, $p := .}}{{if lt $i 15}}<tr><td>{{$p.Path}}</td><td class="num">{{num $p.Count}}</td></tr>{{end}}{{end}}</tbody></table>
</details>
{{end}}{{end}}
</section>
<section class="card" id="lost">
<h2>Lost links</h2>
<p class="small">Every week Supermarket opens each known linking page (at most 100 a day, politely) and checks it still links to your site. A link is <em>gone</em> when the page no longer has it, <em>page gone</em> when the page answers 404 or moved, and <em>points at a 404</em> when the page of yours it links to no longer answers: a redirect on your side fixes that one.</p>
{{with $d.Counts}}<p class="small muted">{{with index . "kept"}}{{num .}} kept · {{end}}{{with index . "unchecked"}}{{num .}} not checked yet · {{end}}{{with index . "gone"}}{{num .}} gone · {{end}}{{with index . "page-gone"}}{{num .}} page gone · {{end}}{{with index . "target-404"}}{{num .}} pointing at a 404{{end}}</p>{{end}}
{{with $d.Lost}}
<table class="list">
<thead><tr><th>Linking page</th><th>What happened</th><th>Last seen</th><th>It brought</th><th></th></tr></thead>
<tbody>{{range .}}{{$b := index $d.Brought .Host}}<tr>
<td class="small"><a href="{{.Source}}" target="_blank" rel="noopener noreferrer">{{truncate 70 .Source}}</a>{{with .Target}}<br><span class="muted">to {{.}}</span>{{end}}</td>
<td class="small"><span class="badge {{if eq .Status "target-404"}}scheduled{{else}}competitor{{end}}">{{if eq .Status "gone"}}gone{{else if eq .Status "page-gone"}}page gone{{else}}points at a 404{{end}}</span><br>{{.Note}}</td>
<td class="small">{{.LastSeen}}</td>
<td class="small">{{if $b.Visitors}}<strong>{{num $b.Visitors}} visitors{{if $b.Signups}}, {{num $b.Signups}} sign-ups{{end}}</strong> in 90 days{{else}}<span class="muted">no visits seen</span>{{end}}</td>
<td><form method="post" action="/seo/links/forget?site={{$d.Current.Index}}" data-confirm="Forget this link?"><input type="hidden" name="id" value="{{.ID}}"><button type="submit" class="link small">Forget</button></form></td>
</tr>{{end}}</tbody>
</table>
{{else}}<p class="help">No lost links{{if $d.LinkCount}} among the {{num $d.LinkCount}} known{{end}}.</p>{{end}}
<div class="row">
<form method="post" action="/seo/links/check?site={{$d.Current.Index}}" data-busy="Checking…"><button type="submit" class="secondary small">Check the links due now</button></form>
<span class="small muted">Up to 20 at a time; the rest are checked daily.</span>
</div>
<form method="post" action="/seo/links/add?site={{$d.Current.Index}}" class="cols" data-busy="Adding and checking…">
<label>A page that links to you <input name="source" type="url" placeholder="https://their-site.example/hosting-providers/" required></label>
<label>Your page it links to <span class="muted">(optional)</span> <input name="target" placeholder="/freescout/"></label>
<div class="actions"><button type="submit" class="secondary">Add and check</button></div>
</form>
</section>
{{end}}
{{end}}{{end}}
{{define "last-read"}}{{with .}}<p class="small {{if .Error}}error-text{{else}}muted{{end}}">Last read {{ago .At}}: {{if .Error}}{{.Error}}{{else}}{{.Detail}}{{end}}</p>{{end}}{{end}}