mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix(dashboard): noindex all paths other than root and status
This commit is contained in:
parent
008caa8473
commit
eb7df8bddb
2 changed files with 10 additions and 2 deletions
2
.github/workflows/dashboard.yml
vendored
2
.github/workflows/dashboard.yml
vendored
|
|
@ -2,9 +2,9 @@ name: Build dashboard Docker image
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'dashboard/**'
|
||||
- '.github/workflows/dashboard.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
|
|||
|
|
@ -38,15 +38,23 @@ func main() {
|
|||
|
||||
r.Use(func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
// only index root and status pages
|
||||
if r.URL.Path != "/" && r.URL.Path != "/status" {
|
||||
rw.Header().Set("X-Robots-Tag", "noindex")
|
||||
}
|
||||
|
||||
rw.Header().Set("X-PluralKit-Version", version)
|
||||
next.ServeHTTP(rw, r)
|
||||
})
|
||||
})
|
||||
|
||||
r.Get("/robots.txt", func(rw http.ResponseWriter, r *http.Request) {
|
||||
rw.Write([]byte("User-Agent: *\nAllow: /$\nAllow: /status\nDisallow: /\n"))
|
||||
})
|
||||
|
||||
r.NotFound(notFoundHandler)
|
||||
|
||||
r.Get("/profile/{type}/{id}", func(rw http.ResponseWriter, r *http.Request) {
|
||||
rw.Header().Set("X-Robots-Tag", "noindex")
|
||||
defer func() {
|
||||
if a := recover(); a != nil {
|
||||
notFoundHandler(rw, r)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue