feat: robots.txt served file, AI bots and the non-production lock

- github.com/jimsmart/grobotstxt v1.0.3 (D-99, decision note in the
  framework repo)
- golem15_seo_robots singleton: rules and AI bot switches; eleven bots
  incl. Claude-User, all allowed by default
- GET /robots.txt: rules, a Disallow group per switched-off bot and the
  golem15.seo.robots_sitemaps lines; outside production the lock with
  X-Robots-Tag; never a 5xx (last good body, else allow-all)
- TestRobots on Google's matcher with the deciding line, and the
  noindex-blocked check (D-24)
This commit is contained in:
2026-10-27 11:45:44 +01:00
parent 4cb0fbfebb
commit 3dd936202f
11 changed files with 643 additions and 5 deletions

View File

@@ -15,12 +15,16 @@ const (
BucketResolve = "seo-resolve"
// BucketNotFound is the 404 report endpoint's bucket.
BucketNotFound = "seo-notfound"
// BucketRobots is the /robots.txt bucket.
BucketRobots = "seo-robots"
)
// Routes mounts the /_seo/api/v1 endpoints. They carry no backend
// middleware: the frontend server calls them anonymously (the 404 report
// with its own token). Every answer carries X-Robots-Tag: noindex.
// Routes mounts GET /robots.txt at the site root and the /_seo/api/v1
// endpoints. None carries backend middleware: crawlers and the frontend
// server call them anonymously (the 404 report with its own token). Every
// /_seo/api/v1 answer carries X-Robots-Tag: noindex.
func (p *Plugin) Routes(r pact.Router) error {
r.Get("/robots.txt", apicontrollers.Robots(p.Service), "throttle:"+BucketRobots)
r.Group("/_seo/api/v1", nil, func(g pact.Router) {
g.Get("/resolve", noindex(apicontrollers.Resolve(p.Service)), "throttle:"+BucketResolve)
g.Post("/notfound", noindex(apicontrollers.NotFound(p.Service)), "throttle:"+BucketNotFound)
@@ -38,8 +42,8 @@ func noindex(h http.HandlerFunc) http.HandlerFunc {
// Buckets registers the per-client-IP buckets behind the configured
// trusted proxies: seo-resolve 600 a minute (the frontend server resolves
// every page it renders) and seo-notfound 600 a minute (one report per
// 404 page).
// every page it renders), seo-notfound 600 a minute (one report per 404
// page) and seo-robots 120 a minute.
func (p *Plugin) Buckets() map[string]surf.Bucket {
trusted := surf.TrustedProxies(nil)
if p.app != nil {
@@ -58,5 +62,6 @@ func (p *Plugin) Buckets() map[string]surf.Bucket {
return map[string]surf.Bucket{
BucketResolve: bucket(BucketResolve, 600),
BucketNotFound: bucket(BucketNotFound, 600),
BucketRobots: bucket(BucketRobots, 120),
}
}