package api import ( "net/http" "git.golem15.com/golem15/sm-seo-plugin/classes" ) // LLMS serves GET /llms.txt at the site root (D-25, UI-SPEC C25): while // llms.txt is on (the robots.txt screen's AI bots tab) and in production, // the site's indexable pages from the sitemaps as text/plain; otherwise // 404. func LLMS(service func() *classes.Service) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { svc := service() if svc == nil { http.Error(w, "SEO is not available", http.StatusServiceUnavailable) return } body, ok, err := svc.LLMSText(r.Context()) if err != nil { log.Error("golem15.seo: llms.txt", "error", err) http.Error(w, "Internal Server Error", http.StatusInternalServerError) return } if !ok { http.NotFound(w, r) return } w.Header().Set("Content-Type", "text/plain; charset=utf-8") w.Header().Set("X-Content-Type-Options", "nosniff") _, _ = w.Write([]byte(body)) } }