SEO: daily clicks chart, top searches, percentages, daily email

- The morning check draws clicks by day, this week over the week before.
- The morning check and the Monday report list the searches that gained
  and lost most clicks (any size; real moves stay on their own list).
- The week's clicks and impressions show their change in percent.
- Settings → Search engines can email the morning check, at most once a
  day, when something really moved. Both emails carry the new lists.
- With a domain property, a line says how many clicks went to its other
  hosts (a shop, a Gitea…) and for which search.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-24 06:55:54 -07:00
co-authored by Claude Opus 5.5
parent 1702fccbcc
commit aeba28b658
13 changed files with 598 additions and 20 deletions
+3 -3
View File
@@ -104,7 +104,7 @@ func TestSearchConsole(t *testing.T) {
// The morning check: last week has data, the week before none, so the
// pages are new.
body = do(h, http.MethodGet, "/seo/check", nil, nil).Body.String()
for _, want := range []string{"2026-11-04 to 2026-11-10", "/pricing/", "new"} {
for _, want := range []string{"2026-11-04 to 2026-11-10", "/pricing/", "new", `class="chart line-chart"`, "<polyline class=\"this\""} {
if !strings.Contains(body, want) {
t.Errorf("check lacks %q", want)
}
@@ -123,8 +123,8 @@ func TestSearchConsole(t *testing.T) {
}
}
// Thresholds.
postForm(h, "/settings/search", url.Values{"min_clicks": {"10"}, "min_positions": {"2.5"}, "min_impressions": {"500"}, "email_report": {"on"}})
if body := do(h, http.MethodGet, "/settings/search", nil, nil).Body.String(); !strings.Contains(body, `name="min_positions" inputmode="decimal" value="2.5"`) || !strings.Contains(body, `name="email_report" checked`) {
postForm(h, "/settings/search", url.Values{"min_clicks": {"10"}, "min_positions": {"2.5"}, "min_impressions": {"500"}, "email_report": {"on"}, "email_check": {"on"}})
if body := do(h, http.MethodGet, "/settings/search", nil, nil).Body.String(); !strings.Contains(body, `name="min_positions" inputmode="decimal" value="2.5"`) || !strings.Contains(body, `name="email_report" checked`) || !strings.Contains(body, `name="email_check" checked`) {
t.Error("thresholds weren't saved")
}
}