diff --git a/main.go b/main.go index 3186fb3..1e72a42 100644 --- a/main.go +++ b/main.go @@ -78,7 +78,6 @@ func main() { "relay_sitemap": "sitemap.xml", "archive": "archive.html", "archive_sitemap": "sitemap.xml", - "robots": "robots.txt", } funcMap := template.FuncMap{ diff --git a/render_robots.go b/render_robots.go index f98caaa..e73fb23 100644 --- a/render_robots.go +++ b/render_robots.go @@ -1,17 +1,16 @@ package main import ( + "fmt" "net/http" ) func renderRobots(w http.ResponseWriter, r *http.Request) { - typ := "robots" w.Header().Set("Cache-Control", "max-age=3600") + fmt.Fprintf(w, `User-agent: * +Allow: / - params := map[string]any{} - - if err := tmpls.ExecuteTemplate(w, templateMapping[typ], params); err != nil { - log.Error().Err(err).Msg("error rendering") - return - } +Sitemap: https://{{%s}}/npubs-archive.xml +Sitemap: https://{{%s}}/relays-archive.xml +`, s.CanonicalHost, s.CanonicalHost) } diff --git a/templates/robots.txt b/templates/robots.txt deleted file mode 100644 index 5bb3351..0000000 --- a/templates/robots.txt +++ /dev/null @@ -1,5 +0,0 @@ -User-agent: * -Allow: / - -Sitemap: https://{{s.CanonicalHost}}/npubs-archive.xml -Sitemap: https://{{s.CanonicalHost}}/relays-archive.xml