Skip to content

Commit 17fea11

Browse files
committed
add robots.txt
1 parent 51264a2 commit 17fea11

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ var indexTemplate = template.Must(template.ParseFiles("views/base.html",
2323
"views/index.html", "views/footer.html"))
2424

2525
func HomeHandler(w http.ResponseWriter, r *http.Request) {
26+
if r.URL.Path == "/robots.txt" {
27+
f, err := ioutil.ReadFile("public/robots.txt")
28+
if err != nil {
29+
http.NotFound(w, r)
30+
return
31+
}
32+
w.Write(f)
33+
return
34+
}
2635
indexTemplate.Execute(w, nil)
2736
}
2837

@@ -46,6 +55,9 @@ type Error struct {
4655
Error string
4756
}
4857

58+
func RobotHandler(w http.ResponseWriter, r *http.Request) {
59+
}
60+
4961
func main() {
5062

5163
port := flag.String("port", ":8004", "port to start the app on")
@@ -54,6 +66,7 @@ func main() {
5466
r := mux.NewRouter()
5567

5668
r.HandleFunc("/", HomeHandler)
69+
r.HandleFunc("/robots.txt", HomeHandler)
5770

5871
r.HandleFunc("/modules", controllers.ModulesHandler)
5972
r.HandleFunc("/modules/{tissue}/{modules}/genes", controllers.GeneList)

public/robots.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
User-agent: *
2+
Disallow: /modules
3+
Disallow: /network
4+
Disallow: /public
5+
Disallow: /search
6+
Disallow: /gene
7+
Disallow: /common
8+
Disallow: /geneset
9+
Disallow: /compare
10+
Disallow: /clinical-comparison
11+
Disallow: /tissues
12+
Disallow: /resources
13+
Disallow: /userlist
14+
Disallow: /common-go
15+
Disallow: /suggest-papers
16+
Disallow: /tomgraph
17+

0 commit comments

Comments
 (0)