Phase 3 part 4: changes approved one at a time, as Gitea pull requests

Proposals (at most 3 waiting) for pages on page one without clicks and
for the audit's title and description issues: the AI writes the title
(without the site's suffix, within the pixel budget) and description
from the live page and its searches. A yes syncs a working copy of the
site's Gitea repository (token as a header only), finds the page's Hugo
content file, sets title and description in its front matter, builds
with Hugo to check the page comes out as proposed, pushes a branch and
opens a pull request; it never merges. Merged changes are checked on
the live site, then compared before and after from Search Console.
Hugo is in the image. Schema 15.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 08:04:01 -07:00
co-authored by Claude Opus 5.5
parent 43a7b42126
commit 438192faba
26 changed files with 2267 additions and 11 deletions
+1
View File
@@ -43,6 +43,7 @@
<a href="/seo/check" {{if eq $nav "seo/check"}}aria-current="page"{{end}}>Morning check</a>
<a href="/seo/report" {{if eq $nav "seo/report"}}aria-current="page"{{end}}>Monday report</a>
<a href="/seo" {{if eq $nav "seo/ranks"}}aria-current="page"{{end}}>What ranks</a>
<a href="/seo/changes" {{if eq $nav "seo/changes"}}aria-current="page"{{end}}>Changes</a>
<a href="/seo/audit" {{if eq $nav "seo/audit"}}aria-current="page"{{end}}>Audit</a>
</div>
{{end}}
@@ -34,6 +34,18 @@
</section>
{{end}}
<section class="card" id="gitea">
<h3>Gitea: your sites' repositories</h3>
<p class="small">For changes you approve: Supermarket pushes a branch to the website's Hugo repository (set in the <a href="/settings/profile">profile</a>) and opens a pull request. It never merges.</p>
<label>Gitea's address <input name="gitea_url" value="{{.GiteaURL}}" placeholder="https://gitea.example.com"></label>
{{template "key-field" (dict "F" .GiteaKey "Set" .GiteaSet)}}
{{if .GiteaSet}}
<button type="button" class="secondary small" hx-post="/settings/search/test/gitea" hx-target="#test-gitea" hx-indicator="#testing-gitea">Test</button>
<span id="testing-gitea" class="htmx-indicator">Checking…</span>
<div id="test-gitea"></div>
{{end}}
</section>
{{if .Connected}}{{$s := .SEO}}
<section class="card">
<h3>The morning check and the Monday report</h3>
+5 -1
View File
@@ -62,7 +62,11 @@
<thead><tr><th></th><th>Issue</th><th>Page</th><th class="num">Clicks</th><th class="num">Impressions</th></tr></thead>
<tbody>{{range $d.Shown}}<tr>
<td><span class="badge {{if eq .Severity "error"}}failed{{else if eq .Severity "warning"}}scheduled{{end}}">{{.Severity}}</span></td>
<td><strong>{{.Title}}</strong>{{with .Detail}}<br><span class="small">{{truncate 400 .}}</span>{{end}}</td>
<td><strong>{{.Title}}</strong>{{with .Detail}}<br><span class="small">{{truncate 400 .}}</span>{{end}}
{{if or (hasPrefix .Code "title-") (hasPrefix .Code "description-")}}<form method="post" action="/seo/changes/page?site={{$d.Current.Index}}" class="inline" data-busy="Writing…">
<input type="hidden" name="page" value="{{.Page}}"><input type="hidden" name="why" value="{{.Title}}. {{.Detail}}">
<input type="hidden" name="what" value="{{if hasPrefix .Code "title-"}}title{{else}}description{{end}}">
<button type="submit" class="link small">Propose a fix</button></form>{{end}}</td>
<td class="small"><a href="{{.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath .Page}}</a></td>
<td class="num">{{if .Traffic.Impressions}}{{num .Traffic.Clicks}}{{else}}<span class="muted">·</span>{{end}}</td>
<td class="num">{{if .Traffic.Impressions}}{{num .Traffic.Impressions}}{{else}}<span class="muted">·</span>{{end}}</td>
+78
View File
@@ -0,0 +1,78 @@
{{define "content"}}{{with .Data}}{{$d := .}}
<div class="heading">
<h1>Changes</h1>
{{if .Current}}<div class="buttons">
<form method="post" action="/seo/changes/suggest?site={{.Current.Index}}" data-busy="Writing…"><button type="submit" class="secondary">Propose changes</button></form>
</div>{{end}}
</div>
<p class="lede">Each change is one page's new title or description, with the number that pays for it. Say yes or no, one at a time: a yes opens a pull request on the site's Gitea repository, checked with a Hugo build. Nothing is published until you merge it. Then Supermarket checks the live page and compares the page's Search Console numbers before and after.</p>
{{if not .Sites}}
<section class="card empty"><p>Add your websites to the <a href="/settings/profile">profile</a> first.</p></section>
{{else}}
{{if gt (len .Sites) 1}}<nav class="tabs">{{range .Sites}}<a href="/seo/changes?site={{.Index}}" {{if eq .Index $d.Current.Index}}aria-current="page"{{end}}>{{.URL}}</a>{{end}}</nav>{{end}}
{{if or (not .Gitea) (not .Repo)}}
<section class="card"><p class="warn-text">Before a yes can open a pull request: {{if not .Gitea}}save a Gitea token under <a href="/settings/search">Settings → Search engines</a>{{end}}{{if and (not .Gitea) (not .Repo)}}, and {{end}}{{if not .Repo}}set this website's Hugo repository in the <a href="/settings/profile">profile</a>{{end}}. You can propose and read changes already.</p></section>
{{end}}
<h2>Waiting for your yes <span class="muted small">at most {{.Max}}</span></h2>
{{range .Waiting}}
<section class="card" id="c-{{.ID}}">
<p><a href="{{.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath .Page}}</a></p>
<p class="small">{{.Why}}</p>
<form method="post" action="/seo/changes/{{.ID}}/save">
{{if .NewTitle}}
<label>Title <span class="muted small">now: “{{.CurTitle}}”</span>
<input name="new_title" value="{{.NewTitle}}">
<span class="help">{{.NewTitleChars}} characters, about {{.NewTitlePixels}} px{{if gt .NewTitlePixels 600}}: <span class="warn-text">Google cuts titles off around 600 px</span>{{end}}.</span></label>
{{else}}<input type="hidden" name="new_title" value="">{{end}}
{{if .NewDescription}}
<label>Description <span class="muted small">now: {{if .CurDescription}}“{{.CurDescription}}”{{else}}none{{end}}</span>
<textarea name="new_description" rows="3">{{.NewDescription}}</textarea>
<span class="help">{{.NewDescriptionChars}} characters, about {{.NewDescriptionPixels}} px{{if gt .NewDescriptionPixels 920}}: <span class="warn-text">Google cuts descriptions off around 920 px</span>{{end}}.</span></label>
{{else}}<input type="hidden" name="new_description" value="">{{end}}
<div class="actions">
<button type="submit" formaction="/seo/changes/{{.ID}}/yes" data-busy="Approving…">Yes: open a pull request</button>
<button type="submit" class="secondary">Save the wording</button>
<button type="submit" class="secondary" formaction="/seo/changes/{{.ID}}/no">No</button>
</div>
</form>
</section>
{{else}}
<section class="card empty"><p>Nothing waiting. <em>Propose changes</em> writes up to {{.Max}}, for the pages on page one that aren't clicked and the audit's title and description issues.</p></section>
{{end}}
{{if .Going}}
<h2>Under way</h2>
<table class="list">
<thead><tr><th>Page</th><th>Change</th><th>Status</th></tr></thead>
<tbody>{{range .Going}}<tr id="c-{{.ID}}">
<td><a href="{{.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath .Page}}</a></td>
<td class="small">{{with .NewTitle}}Title: “{{.}}”<br>{{end}}{{with .NewDescription}}Description: “{{truncate 120 .}}”{{end}}</td>
<td>{{if eq .Status "applying"}}<span class="badge scheduled">making the pull request…</span>
{{else if eq .Status "pr"}}<a class="badge" href="{{.PRURL}}" target="_blank" rel="noopener noreferrer">pull request #{{.PRNumber}} open ↗</a><br><span class="small muted">{{.Note}}</span>
{{else if eq .Status "merged"}}<span class="badge">merged {{ago .MergedAt}}</span><br><span class="small muted">waiting to see it on the live site</span>
{{else if eq .Status "failed"}}<span class="badge failed">failed</span> <span class="small">{{.Error}}</span>
<form method="post" action="/seo/changes/{{.ID}}/yes" class="inline"><button type="submit" class="link small">Try again</button></form>{{end}}
{{with .Diff}}<details class="small"><summary>The diff</summary><pre class="sample">{{.}}</pre></details>{{end}}</td>
</tr>{{end}}</tbody>
</table>
{{end}}
{{if .Done}}
<h2>Done</h2>
<table class="list">
<thead><tr><th>Page</th><th>Change</th><th>Before → after</th></tr></thead>
<tbody>{{range .Done}}<tr>
<td><a href="{{.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath .Page}}</a></td>
<td class="small">{{with .NewTitle}}Title: “{{.}}”<br>{{end}}{{with .NewDescription}}Description: “{{truncate 120 .}}”{{end}}</td>
<td class="small">{{if eq .Status "live"}}Live since {{ago .LiveAt}}.
{{with .Impact}}<br>{{.Days}} days each side: clicks <strong>{{num .Before.Clicks}} → {{num .After.Clicks}}</strong>, impressions {{num .Before.Impressions}} → {{num .After.Impressions}}, click rate {{dec1 .Before.CTR}}% → {{dec1 .After.CTR}}%, position {{dec1 .Before.Position}} → {{dec1 .After.Position}}. Correlation, not proof; a title shows its effect in one to two weeks.{{else}}<br><span class="muted">The numbers after need 3 days of final Search Console data.</span>{{end}}
{{else if eq .Status "declined"}}<span class="muted">You said no {{ago .DecidedAt}}.</span>
{{else if eq .Status "closed"}}<span class="muted">The pull request was closed without merging.</span>{{end}}</td>
</tr>{{end}}</tbody>
</table>
{{end}}
{{end}}
{{end}}{{end}}
+1 -1
View File
@@ -34,7 +34,7 @@
{{range .Waiting}}
<p><a href="{{.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath .Page}}</a><br><span class="small">{{.Why}}</span></p>
{{else}}<p class="help">Nothing this week.</p>{{end}}
<p class="help">Each one is a page that ranks on page one and isn't clicked. The exact change to make (a new title or description, with its length) and the pull request that applies it come with the next part.</p>
<p class="help">Say yes or no to each on <a href="/seo/changes?site={{$d.Current.Index}}">Changes</a>: a yes opens a pull request.</p>
</section>
{{else}}
<section class="card empty"><p>No report yet. It's written on Monday once there are two weeks of data, or now with <em>Write it now</em>.</p></section>
+2 -1
View File
@@ -30,7 +30,8 @@
<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}}
{{range .Push}}<p><a href="{{.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath .Page}}</a><br><span class="small">{{.Why}}</span>
<form method="post" action="/seo/changes/page?site={{$d.Current.Index}}" class="inline" data-busy="Writing…"><input type="hidden" name="page" value="{{.Page}}"><input type="hidden" name="why" value="{{.Why}}"><button type="submit" class="link small">Propose a new title and description</button></form></p>{{else}}<p class="help">No page sits on page one with few clicks. Good, or too little data.</p>{{end}}
</section>
</div>