Files
supermarket/internal/web/templates/seo-links.html
T
davidandClaude Opus 5.5 fc7dcf1f66 Phase 8 part 2: who links to you, from Bing
With a Bing Webmaster key, Supermarket reads once a week (or on Read
now) how many links Bing knows to each page of the site, and for the 25
most linked pages, the pages that link and their anchor text, into the
backlinks table. SEO → Links lists the linking sites, new ones first,
with the pages they link to and their link text; without a key it says
how to get one. A refused key keeps the last read, with the error.

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

65 lines
5.5 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 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>
{{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}}