Files
supermarket/internal/web/templates/seo-changes.html
davidandClaude Opus 5.5 438192faba 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>
2026-11-22 08:04:01 -07:00

79 lines
5.7 KiB
HTML

{{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}}