Fixes from the first round of TEST.md
SEO: a domain property (sc-domain:) covers every subdomain, so the shop, Gitea and forum were counted as the website. What ranks, the morning check, the Monday report, keywords, change candidates and the audit's traffic now read only the website's own host (with or without www). The report keeps pages worth a proposal apart from "Waiting for your yes", explains only moves past the thresholds, and says "places up/down". Also: - Feed summaries drop the posts' scripts and styles. - Spend you log can't be negative. - Test and check buttons can't be clicked twice while they run. - Previews show the site's web fonts and icon sprites. - Backups are read without leaving -wal/-shm files; deleting one removes them, and leftovers are swept at start. - The Overview's setup flags a CRM that Hermes can't reach. - Import now says what came in; adding a prospect that exists says so; prospects can be deleted. - Signal tags and brief addresses keep accented letters (Ü → u). - Page errors start with a capital; clearer messages for bad uploads, CRM retry and cancel, keywords, and the finished audit. - The module you're in stays unfolded in the sidebar. - A picked keyword can be unpicked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+25
-7
@@ -89,6 +89,9 @@ type seoSite struct {
|
||||
Last *seo.SyncResult
|
||||
}
|
||||
|
||||
// scope narrows the site's Search Console property to the website's host.
|
||||
func (st seoSite) scope() seo.Scope { return seo.NewScope(st.Property, st.URL) }
|
||||
|
||||
func (s *Server) seoSites() []seoSite {
|
||||
p, _ := profile.Load(s.DB)
|
||||
if p == nil {
|
||||
@@ -290,7 +293,7 @@ func (s *Server) seoPage(w http.ResponseWriter, r *http.Request) {
|
||||
data, cur := s.seoBase(r)
|
||||
data["Path"], data["Days"] = "/seo", seo.RanksDays
|
||||
if cur != nil {
|
||||
ranks, err := seo.WhatRanks(s.DB, cur.Property)
|
||||
ranks, err := seo.WhatRanks(s.DB, cur.scope())
|
||||
if err != nil {
|
||||
s.serverError(w, err)
|
||||
return
|
||||
@@ -300,16 +303,22 @@ func (s *Server) seoPage(w http.ResponseWriter, r *http.Request) {
|
||||
s.render(w, r, "seo", page{Title: "SEO", Nav: "seo/ranks", Data: data})
|
||||
}
|
||||
|
||||
// pagePath shows a page's address without the site, for tables.
|
||||
// pagePath shows a page's address without the site, for tables. A page on
|
||||
// the www. form of the site keeps its host, so it doesn't look like the
|
||||
// same page as the one without.
|
||||
func pagePath(u string) string {
|
||||
p, err := url.Parse(u)
|
||||
if err != nil || p.Path == "" {
|
||||
return u
|
||||
}
|
||||
out := p.Path
|
||||
if p.RawQuery != "" {
|
||||
return p.Path + "?" + p.RawQuery
|
||||
out += "?" + p.RawQuery
|
||||
}
|
||||
return p.Path
|
||||
if h := strings.ToLower(p.Hostname()); strings.HasPrefix(h, "www.") {
|
||||
out = h + out
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// seoCurrent is the site the request asks for (?site=), or the first.
|
||||
@@ -347,7 +356,7 @@ func (s *Server) seoCheckPage(w http.ResponseWriter, r *http.Request) {
|
||||
data, cur := s.seoBase(r)
|
||||
data["Path"] = "/seo/check"
|
||||
if cur != nil {
|
||||
c, err := seo.MorningCheck(s.DB, cur.Property, seo.LoadSettings(s.DB))
|
||||
c, err := seo.MorningCheck(s.DB, cur.scope(), seo.LoadSettings(s.DB))
|
||||
if err != nil {
|
||||
s.serverError(w, err)
|
||||
return
|
||||
@@ -413,7 +422,7 @@ func (s *Server) seoReportWrite(w http.ResponseWriter, r *http.Request) {
|
||||
// writeReport builds and stores a site's report, and emails it if the
|
||||
// settings say so (and email is set up).
|
||||
func (s *Server) writeReport(ctx context.Context, site seoSite, email bool) (*seo.Report, error) {
|
||||
rep, err := seo.Weekly(s.DB, site.Property, time.Now())
|
||||
rep, err := seo.Weekly(s.DB, site.scope(), time.Now())
|
||||
if err != nil || rep == nil {
|
||||
return rep, err
|
||||
}
|
||||
@@ -590,7 +599,16 @@ func (s *Server) seoAuditStatus(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
if a == nil || a.Status != "running" {
|
||||
w.Header().Set("HX-Refresh", "true")
|
||||
// Reload without the "Auditing…" message the page was opened with.
|
||||
msg := "audited"
|
||||
if a != nil && a.Status == "failed" {
|
||||
msg = ""
|
||||
}
|
||||
target := "/seo/audit?site=" + strconv.Itoa(cur.Index)
|
||||
if msg != "" {
|
||||
target += "&msg=" + msg
|
||||
}
|
||||
w.Header().Set("HX-Redirect", target)
|
||||
}
|
||||
w.Write([]byte(""))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user