package api import ( "net/http" "git.golem15.com/golem15/sm-seo-plugin/classes" "git.golem15.com/golem15/summercms/modules/wire" ) // Site serves GET /_seo/api/v1/site (P33-17): the site facts the frontend // layer needs (site URL, locales, the new-tab switch, the HTML sitemap // settings, the content types' URL patterns, the root file names and // whether llms.txt is served). Every value is public. func Site(service func() *classes.Service) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { svc := service() if svc == nil { wire.WriteJSON(w, http.StatusServiceUnavailable, map[string]string{"error": "SEO is not available"}) return } out, err := svc.Site(r.Context()) if err != nil { log.Error("golem15.seo: site answer", "error", err) wire.WriteJSON(w, http.StatusInternalServerError, map[string]string{"error": errInternal}) return } wire.WriteJSON(w, http.StatusOK, out) } }