Skip to content

Commit 0c7a1db

Browse files
committed
feat: serve robots.txt disallowing all crawlers
Personal read-it-later instance, not meant to be indexed.
1 parent e817192 commit 0c7a1db

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func main() {
8787
e.GET("/articles/:id/assets/*", s.handleArticleAsset)
8888
e.POST("/articles/epub", s.handleEPUB)
8989
e.GET("/readone.user.js", serveUserscript)
90+
e.GET("/robots.txt", handleRobots)
9091
e.StaticFS("/assets", assetsFS)
9192

9293
// The userscript runs on whatever article page the user is reading, so
@@ -108,6 +109,12 @@ func main() {
108109
e.Logger.Fatal(e.Start(":" + port))
109110
}
110111

112+
// This is a personal read-it-later tool, not something meant to be indexed —
113+
// block every crawler rather than trying to enumerate specific ones.
114+
func handleRobots(c echo.Context) error {
115+
return c.String(http.StatusOK, "User-agent: *\nDisallow: /\n")
116+
}
117+
111118
func (s *server) handleIndex(c echo.Context) error {
112119
return c.Blob(http.StatusOK, "text/html; charset=utf-8", indexHTML)
113120
}

0 commit comments

Comments
 (0)