tangled
alpha
login
or
join now
back
round
0
view raw
appview/state: add a permissive robots.txt
#650
merged
opened by
anirudh.fi
3 months ago
targeting
master
from
push-vyusnwqnmxwy
Maybe we load this from disk/elsewhere later?
Signed-off-by: Anirudh Oppiliappan
anirudh@tangled.org
options
unified
split
Changed files
+11
appview
state
router.go
state.go
+1
appview/state/router.go
···
35
35
router.Get("/favicon.svg", s.Favicon)
36
36
router.Get("/favicon.ico", s.Favicon)
37
37
router.Get("/pwa-manifest.json", s.PWAManifest)
38
38
+
router.Get("/robots.txt", s.RobotsTxt)
38
39
39
40
userRouter := s.UserRouter(&middleware)
40
41
standardRouter := s.StandardRouter(&middleware)
+10
appview/state/state.go
···
203
203
s.pages.Favicon(w)
204
204
}
205
205
206
206
+
func (s *State) RobotsTxt(w http.ResponseWriter, r *http.Request) {
207
207
+
w.Header().Set("Content-Type", "text/plain")
208
208
+
w.Header().Set("Cache-Control", "public, max-age=86400") // one day
209
209
+
210
210
+
robotsTxt := `User-agent: *
211
211
+
Allow: /
212
212
+
`
213
213
+
w.Write([]byte(robotsTxt))
214
214
+
}
215
215
+
206
216
// https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest
207
217
const manifestJson = `{
208
218
"name": "tangled",