diff --git a/bindata.go b/bindata.go index 88ed89d..4b246f6 100644 --- a/bindata.go +++ b/bindata.go @@ -5,9 +5,12 @@ import "embed" //go:embed templates/* var TemplatesFS embed.FS -//go:embed static/css/* +//go:embed static/css/* var PublicFS embed.FS //go:embed assets/* var AssetsFS embed.FS +//go:embed static/robots.txt +var RobotsFS embed.FS + diff --git a/main.go b/main.go index 05bcdc7..f199b95 100644 --- a/main.go +++ b/main.go @@ -135,6 +135,19 @@ func main() { handler.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(PublicFS)))) handler.Handle("/assets/", http.FileServer(http.FS(AssetsFS))) + handler.HandleFunc( + "/robots.txt", + func(w http.ResponseWriter, r *http.Request) { + robotsFile, err := RobotsFS.ReadFile("static/robots.txt") + if err != nil { + log.Println(err.Error()) + w.WriteHeader(500) + return + } + w.Write(robotsFile) + }, + ) + handler.HandleFunc( "/download", func(w http.ResponseWriter, r *http.Request) { diff --git a/static/robots.txt b/static/robots.txt new file mode 100644 index 0000000..2370031 --- /dev/null +++ b/static/robots.txt @@ -0,0 +1 @@ +# Go carzy diff --git a/templates/download.html b/templates/download.html index ee355d5..d410022 100644 --- a/templates/download.html +++ b/templates/download.html @@ -11,7 +11,12 @@ Viddle your fiddle
-

Viddle your fiddle

+
+

+ Viddle your fiddle +

Grab your videos for safe keeping!

+ +