Phase 3 part 1: Search Console and what already ranks

PLAN: Phase 3 rewritten around a weekly seven-job SEO loop (what ranks,
next keywords, brief, page, approval, morning check, Monday report),
with chatseo.app's ideas borrowed and rankings from Search Console only.

Google OAuth (PKCE, offline, read-only webmasters scope) from Settings →
Search engines, with each website's property. Search Console is synced
into SQLite by day (site, page, and page+query; 16 months, then twice a
day). SEO → What ranks shows the last 90 days: totals, the share of
clicks from hidden queries, best pages, queries shown but not clicked,
and the pages to protect and to push, each with its numbers. Schema 12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 07:17:37 -07:00
co-authored by Claude Opus 5.5
parent d23d5e2a87
commit 5ea620a091
19 changed files with 1590 additions and 31 deletions
+6
View File
@@ -38,6 +38,11 @@
<a href="/content/published" {{if eq $nav "content/published"}}aria-current="page"{{end}}>Published</a>
</div>
{{end}}
{{if eq .ID "seo"}}
<div class="subnav">
<a href="/seo" {{if eq $nav "seo/ranks"}}aria-current="page"{{end}}>What ranks</a>
</div>
{{end}}
{{if eq .ID "prospects"}}
<div class="subnav">
<a href="/signals" {{if eq $nav "prospects/signals"}}aria-current="page"{{end}}>Signals</a>
@@ -95,6 +100,7 @@
<a href="/settings/sources" {{if eq .Nav "settings/sources"}}aria-current="page"{{end}}>{{template "icon" "prospects"}}Lead sources</a>
<a href="/settings/email" {{if eq .Nav "settings/email"}}aria-current="page"{{end}}>{{template "icon" "email"}}Email</a>
<a href="/settings/tracking" {{if eq .Nav "settings/tracking"}}aria-current="page"{{end}}>{{template "icon" "metrics"}}Website &amp; sales</a>
<a href="/settings/search" {{if eq .Nav "settings/search"}}aria-current="page"{{end}}>{{template "icon" "seo"}}Search engines</a>
<div class="nav-label">AI</div>
<a href="/settings/ai" {{if eq .Nav "settings/ai"}}aria-current="page"{{end}}>{{template "icon" "ai"}}AI</a>
</nav>
@@ -0,0 +1,47 @@
{{define "content"}}{{template "settings-start" .}}{{with .Data}}{{$d := .}}
<h2>Search engines</h2>
<p class="lede">Google Search Console is where Google says what it really shows for your sites: every number in SEO comes from it. Supermarket reads it (read-only) twice a day and keeps 16 months of it.</p>
<form method="post" action="/settings/search" autocomplete="off">
<section class="card" id="google">
<h3>Google Search Console</h3>
{{range .Fields}}{{template "key-field" (dict "F" . "Set" (index $d.Set .Name))}}{{end}}
<p class="help">Redirect URI to register on the OAuth client: <code id="google-redirect">{{.Redirect}}</code> <button type="button" class="link small" data-copy="google-redirect">Copy</button></p>
{{if .Connected}}
<p class="ok">Connected{{with .Account}} as {{.}}{{end}}.</p>
<label class="check small"><input type="checkbox" name="remove:google.refresh_token"> disconnect</label>
{{end}}
</section>
{{if .Connected}}
<section class="card">
<h3>Your websites' properties</h3>
{{with .PropsError}}<p class="error">Couldn't list your properties: {{.}}</p>{{end}}
{{if .Sites}}
{{range .Sites}}
<label>{{.URL}}
<select name="property">
<option value="">none</option>
{{$cur := .Property}}{{range $d.Properties}}<option value="{{.URL}}" {{if eq .URL $cur}}selected{{end}}>{{.URL}}</option>{{end}}
{{if and $cur (not $d.Properties)}}<option value="{{$cur}}" selected>{{$cur}}</option>{{end}}
</select>
{{with .Last}}<span class="help {{if .Error}}error-text{{end}}">Synced {{ago .At}}{{if .Error}}: {{.Error}}{{else}}; data through {{.Through}}{{end}}.</span>{{end}}
</label>
{{end}}
{{else}}<p class="help">Add your websites to the <a href="/settings/profile">profile</a> first.</p>{{end}}
{{if not .Properties}}<p class="help">This account sees no verified properties. Add your site in Search Console, or sign in with the account that owns it.</p>{{end}}
</section>
{{end}}
<div class="actions">
<button type="submit">Save</button>
</div>
</form>
<div class="actions">
{{if and (index .Set "google.client_id") (index .Set "google.client_secret")}}
<form method="post" action="/auth/google/start"><button type="submit" class="{{if .Connected}}secondary{{end}}">{{if .Connected}}Connect again{{else}}Connect Search Console{{end}}</button></form>
{{end}}
{{if .Connected}}<form method="post" action="/settings/search/sync" data-busy="Syncing…"><button type="submit" class="secondary">Sync now</button></form>{{end}}
</div>
{{end}}{{template "settings-end"}}{{end}}
+62
View File
@@ -0,0 +1,62 @@
{{define "content"}}{{with .Data}}{{$d := .}}
<div class="heading">
<h1>What already ranks</h1>
{{if .Current}}<div class="buttons">
<form method="post" action="/settings/search/sync" data-busy="Syncing…"><input type="hidden" name="back" value="/seo?site={{.Current.Index}}"><button type="submit" class="secondary">Sync now</button></form>
</div>{{end}}
</div>
<p class="lede">The cheapest traffic is on pages that already rank. From Search Console, the last {{.Days}} days: the pages that carry your clicks, which to protect, and which to push because Google already shows them and nobody clicks.</p>
{{if not .Connected}}
<section class="card empty"><p>Connect Google Search Console under <a href="/settings/search">Settings → Search engines</a> first.</p></section>
{{else if not .Sites}}
<section class="card empty"><p>Choose the Search Console property for your website under <a href="/settings/search">Settings → Search engines</a>.</p></section>
{{else}}
{{if gt (len .Sites) 1}}<nav class="tabs">{{range .Sites}}<a href="/seo?site={{.Index}}" {{if eq .Index $d.Current.Index}}aria-current="page"{{end}}>{{.URL}}</a>{{end}}</nav>{{end}}
{{with .Ranks}}
<section class="card">
<p class="small muted">{{.Site}} · {{.From}} to {{.To}} (Search Console's final data is 2 to 3 days behind).</p>
<div class="funnel">
<div class="step"><span class="label">Clicks</span><strong>{{num .Total.Clicks}}</strong></div>
<div class="step"><span class="label">Impressions</span><strong>{{num .Total.Impressions}}</strong></div>
<div class="step"><span class="label">Click rate</span><strong>{{dec1 .Total.CTR}}%</strong></div>
<div class="step"><span class="label">Average position</span><strong>{{dec1 .Total.Position}}</strong></div>
</div>
{{if ge .Anonymous 0.0}}<p class="small">{{dec1 .Anonymous}}% of the clicks come from searches Google doesn't name, so the query tables below read low; the page tables don't.</p>{{end}}
</section>
<div class="grid">
<section class="card">
<h2>Protect</h2>
<p class="help">They carry the clicks: don't rewrite them for fun, don't change their address, look at them first.</p>
{{range .Protect}}<p><a href="{{.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath .Page}}</a><br><span class="small">{{.Why}}</span></p>{{else}}<p class="help">No page has clicks yet.</p>{{end}}
</section>
<section class="card">
<h2>Push</h2>
<p class="help">On page one, shown a lot, hardly clicked: Google did the hard part, and the page loses at the click. Compare its main query with its title first.</p>
{{range .Push}}<p><a href="{{.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath .Page}}</a><br><span class="small">{{.Why}}</span></p>{{else}}<p class="help">No page sits on page one with few clicks. Good, or too little data.</p>{{end}}
</section>
</div>
<h2>Best pages</h2>
{{if .Pages}}
<table class="list">
<thead><tr><th>Page</th><th class="num">Clicks</th><th class="num">Impressions</th><th class="num">Click rate</th><th class="num">Position</th></tr></thead>
<tbody>{{range .Pages}}<tr><td><a href="{{.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath .Page}}</a></td><td class="num">{{num .Clicks}}</td><td class="num">{{num .Impressions}}</td><td class="num">{{dec1 .CTR}}%</td><td class="num">{{dec1 .Position}}</td></tr>{{end}}</tbody>
</table>
{{else}}<p class="help">No pages with data yet.</p>{{end}}
<h2>Shown a lot, hardly clicked</h2>
<p class="help">The searches Google shows you for most, with a click rate under 1%.</p>
{{if .Unclicked}}
<table class="list">
<thead><tr><th>Query</th><th class="num">Impressions</th><th class="num">Clicks</th><th class="num">Position</th></tr></thead>
<tbody>{{range .Unclicked}}<tr><td>{{.Query}}</td><td class="num">{{num .Impressions}}</td><td class="num">{{num .Clicks}}</td><td class="num">{{dec1 .Position}}</td></tr>{{end}}</tbody>
</table>
{{else}}<p class="help">None.</p>{{end}}
{{else}}
<section class="card empty"><p>No data yet for {{.Current.Property}}. {{with .Current.Last}}{{if .Error}}The last sync failed: {{.Error}}{{else}}Synced {{ago .At}}, with nothing back.{{end}}{{else}}Sync now to read it.{{end}}</p></section>
{{end}}
{{end}}
{{end}}{{end}}