diff --git a/handlers/handler.go b/handlers/handler.go index f2a902f..e19b3c3 100644 --- a/handlers/handler.go +++ b/handlers/handler.go @@ -5,10 +5,10 @@ import ( "net/http" "github.com/a-h/templ" + gorillaHandlers "github.com/gorilla/handlers" "github.com/gorilla/mux" "github.com/rramiachraf/dumb/views" "github.com/sirupsen/logrus" - gorillaHandlers "github.com/gorilla/handlers" ) func New(logger *logrus.Logger) *mux.Router { @@ -18,6 +18,9 @@ func New(logger *logrus.Logger) *mux.Router { r.Use(gorillaHandlers.CompressHandler) r.Handle("/", templ.Handler(views.HomePage())) + r.HandleFunc("/robots.txt", func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("User-agent: *\nDisallow: /\n")) + }) r.HandleFunc("/albums/{artist}/{albumName}", album(logger)).Methods("GET") r.HandleFunc("/images/{filename}.{ext}", imageProxy(logger)).Methods("GET") r.HandleFunc("/search", search(logger)).Methods("GET") diff --git a/views/album.templ b/views/album.templ index 5e61a04..3cb49fe 100644 --- a/views/album.templ +++ b/views/album.templ @@ -9,7 +9,7 @@ templ AlbumPage(a data.Album) { @layout(fmt.Sprintf("%s - %s", a.Artist, a.Name)) {