File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,6 +80,15 @@ func main() {
8080 loadData ()
8181
8282 http .Handle ("/static/" , http .StripPrefix ("/static/" , http .FileServer (http .Dir ("static" ))))
83+
84+ // Serve robots.txt and sitemap.xml at the site root to aid crawlers
85+ http .HandleFunc ("/robots.txt" , func (w http.ResponseWriter , r * http.Request ) {
86+ http .ServeFile (w , r , "static/robots.txt" )
87+ })
88+ http .HandleFunc ("/sitemap.xml" , func (w http.ResponseWriter , r * http.Request ) {
89+ http .ServeFile (w , r , "static/sitemap.xml" )
90+ })
91+
8392 http .HandleFunc ("/" , homeHandler )
8493 http .HandleFunc ("/draw/create" , createDrawHandler )
8594 http .HandleFunc ("/draw/" , drawHandler )
Original file line number Diff line number Diff line change 1+ User-agent: *
2+ Allow: /
3+ Sitemap: https://secret-santa-draw.app/sitemap.xml
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <urlset xmlns =" http://www.sitemaps.org/schemas/sitemap/0.9" >
3+ <url >
4+ <loc >https://secret-santa-draw.app/draw/create</loc >
5+ <changefreq >weekly</changefreq >
6+ <priority >0.8</priority >
7+ </url >
8+ </urlset >
You can’t perform that action at this time.
0 commit comments