Phase 5 part 1: read a site's section types and pages

Sites → Sections and pages reads the website's Hugo repository: each
section type with the README's description, the fields in use and the
layout's, the pages using it and a real example; the pages and their
sections; the latest commits. Working copies are now held by one job at a
time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 13:52:35 -07:00
co-authored by Claude Opus 5.5
parent 00e6deee00
commit 1152cd448b
15 changed files with 958 additions and 11 deletions
+12 -1
View File
@@ -11,6 +11,7 @@ import (
"net"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
"sync"
@@ -175,6 +176,8 @@ func (s *Server) Handler() (http.Handler, error) {
mux.HandleFunc("POST /metrics/spend", s.metricsSpendAdd)
mux.HandleFunc("POST /metrics/spend/{id}/delete", s.metricsSpendDelete)
mux.HandleFunc("POST /metrics/customers/{id}", s.metricsCustomerMatch)
mux.HandleFunc("GET /sites", s.sitesPage)
mux.HandleFunc("POST /sites/sync", s.sitesSync)
mux.HandleFunc("GET /seo", s.seoPage)
mux.HandleFunc("GET /seo/check", s.seoCheckPage)
mux.HandleFunc("GET /seo/engines", s.seoEnginesPage)
@@ -284,11 +287,19 @@ func sameOrigin(r *http.Request) bool {
return false
}
var backticks = regexp.MustCompile("`([^`]+)`")
// ticks shows Markdown's `code` spans as code, the rest as plain text.
func ticks(s string) template.HTML {
return template.HTML(backticks.ReplaceAllString(template.HTMLEscapeString(s), "<code>$1</code>"))
}
func (s *Server) loadTemplates() error {
funcs := template.FuncMap{
"lines": func(v []string) string { return strings.Join(v, "\n") },
"join": strings.Join,
"ago": ago,
"ticks": ticks,
"add": func(a, b int) int { return a + b },
"hasPrefix": strings.HasPrefix,
"sourceLabel": prospects.SourceLabel,
@@ -413,7 +424,7 @@ var modules = []module{
{"prospects", "Prospects", "Phase 2", "Test buying signals through the whole funnel, from finding prospects to payment; add the people you approve to EspoCRM through Hermes.", "/signals"},
{"seo", "SEO", "Phase 3", "Run the weekly SEO loop from Search Console: what ranks, what moved, and the changes waiting for your yes, opened as pull requests on your Hugo repositories.", "/seo"},
{"metrics", "Metrics", "Phase 4", "MRR, NRR, CAC and CLV from Stripe, with pipeline influence from EspoCRM.", "/metrics"},
{"sites", "Sites", "Phase 5", "Build pages and sites from a component library and publish them through Gitea.", ""},
{"sites", "Sites", "Phase 5", "Build pages from your website's own sections, preview them, and publish them as pull requests on Gitea.", "/sites"},
}
// Modules is for the menu.