Phase 3 part 6: briefs and pages

A brief for a search (a new page) or a page (a rewrite) starts from what
Search Console shows the page for, reads the live top 5 with Claude's web
search (unread results marked, never guessed), and gives the title,
description, H1, angle, sections, questions, internal links to pages we
have, and the questions only the owner can answer. The page is drafted
around those answers, with no invented tests, prices or customers; every
sentence claiming an experience must be confirmed before a pull request
adds or rewrites the page, checked with a Hugo build. Merged pages are
followed to the live site. Schema 17.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 08:18:49 -07:00
co-authored by Claude Opus 5.5
parent c0a5ddf77f
commit 68c224f51b
19 changed files with 1440 additions and 22 deletions
+227
View File
@@ -0,0 +1,227 @@
package web
import (
"context"
"errors"
"net/http"
"strconv"
"strings"
"time"
"supermarket/internal/api/gitea"
"supermarket/internal/seo"
)
func (s *Server) writer() (*seo.Writer, error) {
c, p, err := s.draftClient()
if err != nil {
return nil, err
}
rs, err := s.researcher()
if err != nil {
return nil, err
}
return &seo.Writer{Research: rs, AI: c, Profile: p, Fetcher: seo.NewFetcher("Supermarket/" + s.Version + " (SEO)")}, nil
}
func (s *Server) seoBriefsPage(w http.ResponseWriter, r *http.Request) {
s.renderBriefs(w, r, "")
}
func (s *Server) renderBriefs(w http.ResponseWriter, r *http.Request, errMsg string) {
sites, cur := s.auditSites(r)
data := map[string]any{"Sites": sites, "Current": cur}
if cur != nil {
bs, err := seo.Briefs(s.DB, auditKey(*cur))
if err != nil {
s.serverError(w, err)
return
}
data["Briefs"] = bs
picked, _ := seo.Keywords(s.DB, auditKey(*cur), seo.KeywordPicked)
data["Picked"] = picked
}
s.render(w, r, "seo-briefs", page{Title: "Briefs", Nav: "seo/briefs", Error: errMsg, Data: data})
}
// seoBriefNew writes a brief: for a search (a new page), or for an existing
// page (a rewrite).
func (s *Server) seoBriefNew(w http.ResponseWriter, r *http.Request) {
if err := r.ParseForm(); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
_, cur := s.auditSites(r)
if u := r.PostFormValue("site_url"); u != "" {
if st, ok := s.siteFor(u); ok {
cur = &st
}
}
if cur == nil {
http.NotFound(w, r)
return
}
wr, err := s.writer()
var b *seo.Brief
if err == nil {
ctx, cancel := context.WithTimeout(r.Context(), 6*time.Minute)
defer cancel()
b, err = wr.NewBrief(ctx, s.DB, auditKey(*cur), cur.Property, r.PostFormValue("keyword"), r.PostFormValue("page"), time.Now())
}
if err != nil {
s.renderBriefs(w, r, "Couldn't write the brief: "+err.Error())
return
}
redirect(w, r, "/seo/briefs/"+strconv.FormatInt(b.ID, 10), "brief-written")
}
func (s *Server) seoBriefPage(w http.ResponseWriter, r *http.Request) {
s.renderBrief(w, r, "")
}
func (s *Server) renderBrief(w http.ResponseWriter, r *http.Request, errMsg string) {
id, _ := strconv.ParseInt(r.PathValue("id"), 10, 64)
b, err := seo.GetBrief(s.DB, id)
if err != nil {
http.NotFound(w, r)
return
}
site, _ := s.siteFor(b.Site)
asks := make([]map[string]string, len(b.Plan.Ask))
for i, q := range b.Plan.Ask {
a := ""
if i < len(b.Answers) {
a = b.Answers[i]
}
asks[i] = map[string]string{"Q": q, "A": a}
}
s.render(w, r, "seo-brief", page{Title: "Brief: " + b.Keyword, Nav: "seo/briefs", Error: errMsg, Data: map[string]any{
"B": b, "Site": site, "Asks": asks, "Sections": strings.Join(b.Plan.Sections, "\n"),
"Questions": strings.Join(b.Plan.Questions, "\n"), "Gitea": s.gitea() != nil,
}})
}
func lines(s string) []string {
var out []string
for _, l := range strings.Split(strings.ReplaceAll(s, "\r\n", "\n"), "\n") {
if l = strings.TrimSpace(strings.TrimLeft(strings.TrimSpace(l), "-*• ")); l != "" {
out = append(out, l)
}
}
return out
}
// seoBriefAction handles a brief's buttons.
func (s *Server) seoBriefAction(w http.ResponseWriter, r *http.Request) {
id, err := strconv.ParseInt(r.PathValue("id"), 10, 64)
if err != nil {
http.NotFound(w, r)
return
}
if err := r.ParseForm(); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
b, err := seo.GetBrief(s.DB, id)
if err != nil {
http.NotFound(w, r)
return
}
back := "/seo/briefs/" + strconv.FormatInt(id, 10)
f := r.PostFormValue
saveBrief := func() error {
if _, has := r.PostForm["title"]; !has {
return nil
}
return seo.EditBrief(s.DB, id, seo.Plan{Title: strings.TrimSpace(f("title")), Description: strings.TrimSpace(f("description")),
H1: strings.TrimSpace(f("h1")), Angle: strings.TrimSpace(f("angle")), Sections: lines(f("sections")),
Questions: lines(f("questions")), Needs: b.Plan.Needs}, r.PostForm["answer"], f("path"))
}
var msg string
switch r.PathValue("action") {
case "save":
err, msg = saveBrief(), "saved"
case "write":
if err = saveBrief(); err == nil {
var wr *seo.Writer
if wr, err = s.writer(); err == nil {
ctx, cancel := context.WithTimeout(r.Context(), 6*time.Minute)
_, err = wr.WritePage(ctx, s.DB, id)
cancel()
}
}
msg = "page-written"
case "draft":
_, err = seo.SaveDraft(s.DB, id, f("draft"))
msg = "saved"
case "pr":
if s.gitea() == nil {
err = errNoGitea
break
}
if _, has := r.PostForm["draft"]; has {
if _, err = seo.SaveDraft(s.DB, id, f("draft")); err != nil {
break
}
}
site, ok := s.siteFor(b.Site)
if !ok {
http.NotFound(w, r)
return
}
confirmed := r.PostForm["claim"]
ap := s.applier(site)
// Check the claims now, so a missing one is said on this page.
fresh, _ := seo.GetBrief(s.DB, id)
for _, c := range seo.Claims(fresh.Draft) {
found := false
for _, x := range confirmed {
found = found || x == c
}
if !found {
s.renderBrief(w, r, "Tick each sentence that claims an experience to confirm it's true, or remove it from the page first.")
return
}
}
go func() {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute)
defer cancel()
if err := ap.ApplyBrief(ctx, s.DB, id, confirmed); err != nil {
s.Log.Warn("seo: making the page's pull request", "brief", id, "err", err)
}
}()
msg = "approved"
case "drop":
err, msg = seo.DropBrief(s.DB, id), "deleted"
back = "/seo/briefs"
default:
http.NotFound(w, r)
return
}
if err != nil {
s.renderBrief(w, r, err.Error())
return
}
redirect(w, r, back, msg)
}
var errNoGitea = errors.New("save a Gitea token under Settings → Search engines first")
// refreshBriefs follows the briefs' pull requests, site by site.
func (s *Server) refreshBriefs(ctx context.Context) {
g := s.gitea()
f := seo.NewFetcher("Supermarket/" + s.Version + " (SEO)")
for _, site := range s.seoSites() {
ap := s.applier(site)
_, full, _ := gitea.ParseRepo(ap.Repo)
var gp interface {
GetPull(context.Context, string, int64) (*gitea.Pull, error)
}
if g != nil {
gp = g
}
if err := seo.RefreshBriefs(ctx, s.DB, gp, full, site.URL, f, time.Now()); err != nil {
s.Log.Warn("seo: following briefs", "err", err)
}
}
}
+76
View File
@@ -0,0 +1,76 @@
package web
import (
"context"
"fmt"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
"supermarket/internal/ai"
"supermarket/internal/profile"
"supermarket/internal/secrets"
"supermarket/internal/seo"
)
type briefWriter struct{}
func (briefWriter) Generate(context.Context, ai.Request) (string, error) {
return "## Prices\n\nWe tested it with 12 users. Plans are flat.", nil
}
func (briefWriter) Research(context.Context, ai.ResearchRequest) (*ai.ResearchResult, error) {
return &ai.ResearchResult{Searches: 3, Text: `{"finding":"Nobody shows prices.","top":[{"url":"https://a.example","title":"A","promises":"a list","lacks":"prices","read":true}],
"plan":{"title":"Flat-price workspace","description":"Plans.","h1":"Workspace","angle":"Prices","sections":["Prices","Moving"],
"questions":["How much?"],"links":[],"ask":["Have you moved a team?"],"needs":[]}}`}, nil
}
func TestBriefPages(t *testing.T) {
newAIClient = func(ai.Config, *secrets.Store) (ai.Client, error) { return briefWriter{}, nil }
defer func() { newAIClient = ai.New }()
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, `<urlset></urlset>`) }))
defer srv.Close()
s, h := newTestServer(t, nil)
profile.Save(s.DB, &profile.Profile{Name: "Us", Websites: []profile.Website{{URL: srv.URL}}})
if body := do(h, http.MethodGet, "/seo/briefs", nil, nil).Body.String(); !strings.Contains(body, "Write a brief") {
t.Fatal("no form")
}
rec := postForm(h, "/seo/briefs?site=0", url.Values{"keyword": {"workspace alternative"}})
if rec.Code != http.StatusSeeOther || !strings.HasPrefix(rec.Header().Get("Location"), "/seo/briefs/1") {
t.Fatalf("new: %d %s %s", rec.Code, rec.Header().Get("Location"), rec.Body)
}
body := do(h, http.MethodGet, "/seo/briefs/1", nil, nil).Body.String()
for _, want := range []string{"Nobody shows prices.", `value="Flat-price workspace"`, "Have you moved a team?", "/workspace-alternative/", "Write the page"} {
if !strings.Contains(body, want) {
t.Errorf("brief lacks %q", want)
}
}
form := url.Values{"title": {"Flat-price workspace"}, "description": {"Plans."}, "h1": {"Workspace"}, "angle": {"Prices"},
"sections": {"Prices\nMoving\nFAQ"}, "questions": {"How much?"}, "answer": {"Yes, 12 users."}, "path": {"/workspace/"}}
if rec := postForm(h, "/seo/briefs/1/write", form); rec.Code != http.StatusSeeOther {
t.Fatalf("write: %d %s", rec.Code, rec.Body)
}
b, _ := seo.GetBrief(s.DB, 1)
if len(b.Plan.Sections) != 3 || b.Path != "/workspace/" || b.Answers[0] != "Yes, 12 users." || b.Status != seo.BriefPage {
t.Errorf("saved: %+v", b)
}
body = do(h, http.MethodGet, "/seo/briefs/1", nil, nil).Body.String()
if !strings.Contains(body, "We tested it with 12 users.") || !strings.Contains(body, `name="claim" value="We tested it with 12 users."`) {
t.Error("the draft or its claim isn't shown")
}
if rec := postForm(h, "/seo/briefs/1/pr", url.Values{}); !strings.Contains(rec.Body.String(), "save a Gitea token") {
t.Errorf("pr without Gitea: %d", rec.Code)
}
s.Secrets.Set(map[string]string{secrets.GiteaToken: "tok"})
s.DB.PutJSON(giteaURLKey, "https://gitea.example.com")
if rec := postForm(h, "/seo/briefs/1/pr", url.Values{"draft": {b.Draft}}); !strings.Contains(rec.Body.String(), "Tick each sentence") {
t.Errorf("pr with an unconfirmed claim: %d", rec.Code)
}
postForm(h, "/seo/briefs/1/drop", nil)
if body := do(h, http.MethodGet, "/seo/briefs", nil, nil).Body.String(); strings.Contains(body, "workspace alternative</a>") {
t.Error("a dropped brief is listed")
}
}
+4
View File
@@ -243,6 +243,9 @@ func (s *Server) RunSEO(ctx context.Context) {
if err := seo.RecoverChanges(s.DB); err != nil {
s.Log.Error("seo: recovering changes", "err", err)
}
if err := seo.RecoverBriefs(s.DB); err != nil {
s.Log.Error("seo: recovering briefs", "err", err)
}
tick := time.NewTicker(30 * time.Minute)
defer tick.Stop()
for {
@@ -264,6 +267,7 @@ func (s *Server) RunSEO(ctx context.Context) {
s.weeklyReports(ctx, time.Now())
}
s.refreshChanges(ctx)
s.refreshBriefs(ctx)
select {
case <-ctx.Done():
return
+6
View File
@@ -161,6 +161,10 @@ func (s *Server) Handler() (http.Handler, error) {
mux.HandleFunc("POST /settings/email/send-test", s.emailSendTest)
mux.HandleFunc("GET /seo", s.seoPage)
mux.HandleFunc("GET /seo/check", s.seoCheckPage)
mux.HandleFunc("GET /seo/briefs", s.seoBriefsPage)
mux.HandleFunc("POST /seo/briefs", s.seoBriefNew)
mux.HandleFunc("GET /seo/briefs/{id}", s.seoBriefPage)
mux.HandleFunc("POST /seo/briefs/{id}/{action}", s.seoBriefAction)
mux.HandleFunc("GET /seo/keywords", s.seoKeywordsPage)
mux.HandleFunc("POST /seo/keywords", s.seoKeywordsFind)
mux.HandleFunc("POST /seo/keywords/{id}/{action}", s.seoKeywordAction)
@@ -421,6 +425,8 @@ var flashes = map[string]string{
"google-connected": "Search Console is connected. Choose each website's property below, then sync.",
"synced": "Synced from Search Console.",
"report-written": "This week's report is written.",
"brief-written": "Brief written. Read it, answer its questions, then write the page.",
"page-written": "Page drafted. Read it, and confirm or remove every sentence that claims an experience.",
"keywords-found": "Looked for keywords: the candidates are below.",
"top-read": "Read the live top results.",
"proposed": "Proposed: read each one, edit it if you like, then say yes or no.",
+1 -1
View File
@@ -100,7 +100,7 @@ func TestEveryPageRenders(t *testing.T) {
"/settings/ai", "/settings/accounts", "/settings/core", "/static/app.css", "/favicon.ico", "/static/favicon.png", "/static/logo.png", "/static/apple-touch-icon.png", "/search", "/crm", "/search?q=rival", "/search?q=nothing+here", "/static/htmx.min.js", "/healthz",
"/content", "/content/1", "/content/1?dismissed=1", "/posts", "/posts?msg=drafted",
"/content/scheduled", "/content/published",
"/prospects", "/prospects?status=accepted", "/prospects?status=rejected", "/prospects/new", "/prospects/suppressed", "/outreach", "/outreach?tab=queued", "/outreach?tab=sent", "/outreach?tab=replied", "/outreach?tab=failed", "/settings/email", "/settings/tracking", "/settings/search", "/seo", "/seo/check", "/seo/report", "/seo/audit", "/seo/changes", "/seo/keywords",
"/prospects", "/prospects?status=accepted", "/prospects?status=rejected", "/prospects/new", "/prospects/suppressed", "/outreach", "/outreach?tab=queued", "/outreach?tab=sent", "/outreach?tab=replied", "/outreach?tab=failed", "/settings/email", "/settings/tracking", "/settings/search", "/seo", "/seo/check", "/seo/report", "/seo/audit", "/seo/changes", "/seo/keywords", "/seo/briefs",
"/signals", "/signals?period=30d&channel=email", "/signals/new", "/settings/sources"} {
rec := do(h, http.MethodGet, path, nil, nil)
if rec.Code != http.StatusOK {
+2
View File
@@ -434,3 +434,5 @@ table.runs { margin-top: 0.75rem; }
/* Long addresses in tables and check lists wrap instead of widening the page. */
.checks li, .list td .small, .list td a { overflow-wrap: anywhere; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9rem; }
+1
View File
@@ -45,6 +45,7 @@
<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/keywords" {{if eq $nav "seo/keywords"}}aria-current="page"{{end}}>Next keywords</a>
<a href="/seo/briefs" {{if eq $nav "seo/briefs"}}aria-current="page"{{end}}>Briefs and pages</a>
<a href="/seo/audit" {{if eq $nav "seo/audit"}}aria-current="page"{{end}}>Audit</a>
</div>
{{end}}
+72
View File
@@ -0,0 +1,72 @@
{{define "content"}}{{with .Data}}{{$b := .B}}{{$d := .}}
<div class="heading">
<h1>{{$b.Keyword}}</h1>
<div class="buttons"><a class="button secondary" href="/seo/briefs?site={{.Site.Index}}">All briefs</a></div>
</div>
<p class="lede">{{if $b.Page}}Rewrite of <a href="{{$b.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath $b.Page}}</a>{{else}}A new page{{end}} · {{template "brief-status" $b}}{{if $b.Searches}} · {{$b.Searches}} web searches{{end}}{{with $b.Error}} · <span class="error-text">{{.}}</span>{{end}}</p>
{{with $b.Plan.Finding}}<section class="card"><h2>What the data shows first</h2><p>{{.}}</p></section>{{end}}
{{if $b.ShownFor}}
<h2>What Google shows it for</h2>
<table class="list">
<thead><tr><th>Search</th><th class="num">Impressions</th><th class="num">Clicks</th><th class="num">Position</th></tr></thead>
<tbody>{{range $b.ShownFor}}<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>
{{end}}
<h2>The live top results</h2>
<ol class="items">{{range $b.Top}}<li class="item"><a href="{{.URL}}" target="_blank" rel="noopener noreferrer">{{or .Title .URL}}</a>
{{if not .Read}}<span class="badge failed">couldn't be read</span>{{end}}
<div class="small">{{with .Promises}}Promises: {{.}}. {{end}}{{with .Lacks}}{{.}}{{end}}</div></li>{{else}}<li class="item muted">None found.</li>{{end}}</ol>
<form method="post" action="/seo/briefs/{{$b.ID}}/save">
<section class="card">
<h2>The brief</h2>
<label>Title <input name="title" value="{{$b.Plan.Title}}"></label>
<label>Meta description <textarea name="description" rows="2">{{$b.Plan.Description}}</textarea></label>
<label>H1 <input name="h1" value="{{$b.Plan.H1}}"></label>
<label>The angle <textarea name="angle" rows="2">{{$b.Plan.Angle}}</textarea></label>
<label>Sections, in order <span class="muted small">one per line</span><textarea name="sections" rows="6">{{.Sections}}</textarea></label>
<label>Questions the page must answer <span class="muted small">one per line</span><textarea name="questions" rows="4">{{.Questions}}</textarea></label>
{{if $b.Plan.Links}}<p class="small"><strong>Internal links:</strong> {{range $i, $l := $b.Plan.Links}}{{if $i}} · {{end}}<a href="{{$l.URL}}" target="_blank" rel="noopener noreferrer">{{pagePath $l.URL}}</a> <span class="muted">({{$l.Why}})</span>{{end}}</p>{{end}}
{{if $b.Plan.Needs}}<p class="small"><strong>Beyond the text, it needs:</strong> {{range $i, $n := $b.Plan.Needs}}{{if $i}}; {{end}}{{$n}}{{end}}</p>{{end}}
{{if not $b.Page}}<label>Address of the new page <input name="path" value="{{$b.Path}}"></label>{{end}}
</section>
<section class="card">
<h2>Only you can answer</h2>
<p class="help">The page is written around these answers, and claims nothing else. If you didn't test something, say “not tested”: the page will say so.</p>
{{range .Asks}}<label>{{.Q}} <textarea name="answer" rows="2">{{.A}}</textarea></label>{{end}}
<div class="actions">
<button type="submit" formaction="/seo/briefs/{{$b.ID}}/write" data-busy="Writing the page…">{{if $b.Draft}}Write the page again{{else}}Write the page{{end}}</button>
<button type="submit" class="secondary">Save</button>
</div>
</section>
</form>
{{if $b.Draft}}
<form method="post" action="/seo/briefs/{{$b.ID}}/draft">
<section class="card">
<h2>The page</h2>
<textarea name="draft" rows="24" class="mono">{{$b.Draft}}</textarea>
{{if $b.Claims}}
<h3>Sentences that claim an experience</h3>
<p class="help">Each one must be true. Tick it if it is; if it isn't, edit or delete it in the page above and save.</p>
{{range $b.Claims}}<label class="check"><input type="checkbox" name="claim" value="{{.}}"> {{.}}</label>{{end}}
{{else}}<p class="help">No sentence claims an experience.</p>{{end}}
<div class="actions">
<button type="submit" class="secondary">Save the page</button>
{{if or (eq $b.Status "page") (eq $b.Status "failed")}}<button type="submit" formaction="/seo/briefs/{{$b.ID}}/pr" data-busy="Opening…" {{if not $d.Gitea}}disabled title="Save a Gitea token first"{{end}}>Open a pull request</button>{{end}}
</div>
{{with $b.Note}}<p class="small muted">{{.}}</p>{{end}}
</section>
</form>
{{end}}
{{if or (eq $b.Status "brief") (eq $b.Status "page") (eq $b.Status "failed")}}
<form method="post" action="/seo/briefs/{{$b.ID}}/drop" data-confirm="Set this brief aside?" class="danger-zone"><button type="submit" class="secondary small">Set it aside</button></form>
{{end}}
{{end}}{{end}}
{{define "brief-status"}}{{if eq .Status "brief"}}<span class="badge draft">brief: your answers</span>{{else if eq .Status "page"}}<span class="badge draft">page drafted: check it</span>{{else 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}} ↗</a>{{else if eq .Status "merged"}}<span class="badge">merged</span>{{else if eq .Status "live"}}<span class="badge published">live</span>{{else if eq .Status "failed"}}<span class="badge failed">failed</span>{{end}}{{end}}
+35
View File
@@ -0,0 +1,35 @@
{{define "content"}}{{with .Data}}{{$d := .}}
<div class="heading"><h1>Briefs and pages</h1></div>
<p class="lede">A brief is the page before the page. It starts from what Google really shows the page for, then reads the live top 5 for the search, then says what the page must promise and cover, in what order, and what only you can answer. You answer; the AI writes the page around your answers; you confirm every sentence that claims an experience; a pull request carries it to the site.</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/briefs?site={{.Index}}" {{if eq .Index $d.Current.Index}}aria-current="page"{{end}}>{{.URL}}</a>{{end}}</nav>{{end}}
<form method="post" action="/seo/briefs?site={{.Current.Index}}" class="card" data-busy="Writing the brief… (a minute or two)">
<h2>Write a brief</h2>
<div class="cols">
<label>For a new page, the search {{if .Picked}}<span class="small muted">(your picks: {{range $i, $k := .Picked}}{{if $i}}, {{end}}{{$k.Keyword}}{{end}})</span>{{end}}
<input name="keyword" list="picked" placeholder="e.g. google workspace alternative">
<datalist id="picked">{{range .Picked}}<option value="{{.Keyword}}">{{end}}</datalist></label>
<label>Or, to rewrite a page, its address <input name="page" placeholder="{{.Current.URL}}/pricing/"></label>
</div>
<p class="help">It uses up to 5 web searches to read the live top results. For a rewrite, the search defaults to the one the page is shown for most.</p>
<div class="actions"><button type="submit">Write the brief</button></div>
</form>
{{if .Briefs}}
<table class="list">
<thead><tr><th>Search</th><th>Page</th><th>Status</th></tr></thead>
<tbody>{{range .Briefs}}<tr>
<td><a href="/seo/briefs/{{.ID}}">{{.Keyword}}</a></td>
<td class="small">{{if .Page}}<a href="{{.Page}}" target="_blank" rel="noopener noreferrer">{{pagePath .Page}}</a>{{else}}new: {{.Path}}{{end}}</td>
<td>{{template "brief-status" .}}</td>
</tr>{{end}}</tbody>
</table>
{{end}}
{{end}}
{{end}}{{end}}
{{define "brief-status"}}{{if eq .Status "brief"}}<span class="badge draft">brief: your answers</span>{{else if eq .Status "page"}}<span class="badge draft">page drafted: check it</span>{{else 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}} ↗</a>{{else if eq .Status "merged"}}<span class="badge">merged</span>{{else if eq .Status "live"}}<span class="badge published">live</span>{{else if eq .Status "failed"}}<span class="badge failed">failed</span>{{end}}{{end}}
+2 -1
View File
@@ -39,7 +39,8 @@
Volume and difficulty: not available.</p>
</div>
<div class="row-actions">
{{if ne .Status "picked"}}<form method="post" action="/seo/keywords/{{.ID}}/pick"><button type="submit" class="small">Pick this one</button></form>{{end}}
{{if ne .Status "picked"}}<form method="post" action="/seo/keywords/{{.ID}}/pick"><button type="submit" class="small">Pick this one</button></form>
{{else}}<form method="post" action="/seo/briefs" data-busy="Writing the brief…"><input type="hidden" name="site_url" value="{{.Site}}"><input type="hidden" name="keyword" value="{{.Keyword}}"><button type="submit" class="small">Write the brief</button></form>{{end}}
{{if eq .Status "dismissed"}}<form method="post" action="/seo/keywords/{{.ID}}/restore"><button type="submit" class="secondary small">Bring back</button></form>
{{else}}<form method="post" action="/seo/keywords/{{.ID}}/dismiss"><button type="submit" class="secondary small">Dismiss</button></form>{{end}}
</div>
+2 -1
View File
@@ -31,7 +31,8 @@
<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>
<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}}
<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>
· <form method="post" action="/seo/briefs?site={{$d.Current.Index}}" class="inline" data-busy="Writing the brief…"><input type="hidden" name="page" value="{{.Page}}"><button type="submit" class="link small">Write a brief to rewrite it</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>