mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-29 22:46:15 -06:00
use switch for RobotsHeaders
This commit is contained in:
parent
419294704e
commit
5fa33bcad5
1 changed files with 12 additions and 10 deletions
|
|
@ -41,25 +41,27 @@ func RobotsHeaders(mode string) gin.HandlerFunc {
|
|||
noai = "noai, noimageai"
|
||||
)
|
||||
|
||||
if mode == "aiOnly" {
|
||||
switch mode {
|
||||
|
||||
// Just set ai headers and
|
||||
// leave the other headers be.
|
||||
case "aiOnly":
|
||||
return func(c *gin.Context) {
|
||||
c.Writer.Header().Set(key, noai)
|
||||
}
|
||||
}
|
||||
|
||||
if mode == "allowSome" {
|
||||
// Allow some limited indexing.
|
||||
case "allowSome":
|
||||
return func(c *gin.Context) {
|
||||
c.Writer.Header().Set(key, apiutil.RobotsDirectivesAllowSome)
|
||||
c.Writer.Header().Add(key, noai)
|
||||
}
|
||||
}
|
||||
|
||||
// Disallow indexing via noindex, nofollow.
|
||||
default:
|
||||
return func(c *gin.Context) {
|
||||
c.Writer.Header().Set(key, apiutil.RobotsDirectivesDisallow)
|
||||
c.Writer.Header().Add(key, noai)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue