From 8fd3811a722078aa98f728ce6757e337a735d414 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Wed, 13 Sep 2023 18:23:15 +0300 Subject: [PATCH] fix: sitemap at root --- main.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index c6d08a3..354f133 100644 --- a/main.go +++ b/main.go @@ -126,7 +126,6 @@ func init() { log.Println("[ init ] Starting...") templates = template.Must(template.ParseFS(TemplatesFS , "templates/*.html")) log.Println("[ init ] Templates Loaded") - log.Println(AssetsFS.ReadDir("assets")) } @@ -149,6 +148,20 @@ func main() { }, ) + handler.HandleFunc( + "/sitemap.txt", + func(w http.ResponseWriter, r *http.Request) { + sitemapFile, err := AssetsFS.ReadFile("assets/sitemap.txt") + if err != nil { + log.Println(err.Error()) + w.WriteHeader(500) + return + } + w.Write(sitemapFile) + }, + ) + + handler.HandleFunc( "/download", func(w http.ResponseWriter, r *http.Request) {