Serve robots.txt from /

This change allows `robots.txt` to be served from the root URL, i.e.
https://drone.io/robots.txt, which is where [web crawlers will look for
it][1]. Previously this file was only served from `/static/robots.txt`.

[1]: http://www.robotstxt.org/robotstxt.html
This commit is contained in:
Michael Steinert 2014-12-24 12:59:03 -06:00
parent f1c5a45b5a
commit 441de03fb9
2 changed files with 2 additions and 1 deletions

View file

@ -1 +1 @@
User-agent: *
User-agent: *

View file

@ -137,6 +137,7 @@ func main() {
// create handler for static resources
assets := rice.MustFindBox("app").HTTPBox()
assetserve := http.FileServer(rice.MustFindBox("app").HTTPBox())
http.Handle("/robots.txt", assetserve)
http.Handle("/static/", http.StripPrefix("/static", assetserve))
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write(assets.MustBytes("index.html"))